Itako Token
Installation
npm install itako-token --save
Usage
itako-token
has type
and value
and reader options
.
;;; const token = 'text' 'greeting' volume: 1 pitch: 15; // speech-synthesis say "greeting" using option;
API
the class defines the reader type, sentence, and grant information for itako-readers.
setType(type)
-> this
define the type of reader
. reader
will ignore the except specific type
(eg text-reader ignores the audio
type).
setValue(value)
-> this
define the reader read aloud value
(eg text
or audio file url
).
setOption(key, value)
-> this
setOptions(options)
-> this
define the grant information about the read aloud(eg volume
, pitch
, speaker
, etc).
setMeta(key, value)
-> this
define the meta information for debug.
clone(meta)
-> token
create a new instance using an instance.
const token = 'text' 'greeting' volume: 1 pitch: 15 ;const clonedToken = token; console;// {"type":"text","value":"greeting","options":{"volume":1,"pitch":1.5},"meta":{}}console;// {"type":"text","value":"greeting","options":{"volume":0.5,"pitch":1.5},"meta":{"cloned":true}}
Stacktrace was broken
node> require# TypeError: Cannot convert undefined or null to object # at f (/Users/itakojs/itako-token/lib/index.js:1:2469)
published code is compressed and the source map is provided. not supported by the sourcemap in NodeJS. but this resolved in the node-source-map-support.
npm install source-map-support --save-dev
;
or...
$ mocha --require source-map-support/register
Development
Requirement global
- NodeJS v5.10.0
- Npm v3.8.3
git clone https://github.com/itakojs/itako-tokencd itako-tokennpm install npm test