kewt
interfaces for setting, fetching, persisting, and rendering text track styling
Example
The following code loads a DOM ready interface that checks for existing settings on localstorage, sets new values for a variety of options, persists the changes to localstorage, and renders a style tag to the document head.
; KewtDOM ;
Settings
Setting | Default | Options |
---|---|---|
font |
'monospaced-serif' |
'monospaced-serif' , 'sans-serif' , 'serif' |
fontSize |
'3' |
'1' -'6' |
fontEdge |
none |
'none' , 'uniform' , 'raised' , 'shadow' , 'depressed' |
edgeHighlight |
'black' |
'black' , 'blue' , 'green' , 'teal' , 'red' , 'purple' , 'yellow' , 'white' |
edgeOpacity |
'0' |
'0' -'100' |
textColor |
'white' |
'black' , 'blue' , 'green' , 'teal' , 'red' , 'purple' , 'yellow' , 'white' |
textOpacity |
'100' |
'0' -'100' |
backgroundColor |
'black' |
'black' , 'blue' , 'green' , 'teal' , 'red' , 'purple' , 'yellow' , 'white' |
backgroundOpacity |
'100' |
'0' -'100' |
Kewt
Kind: global class
- Kewt
- new Kewt(options, defaults)
- .reset() ⇒
Kewt
- .get([property]) ⇒
string
|object
- .set(property, [value]) ⇒
Kewt
- .setProperty(property, value) ⇒
Kewt
new Kewt(options, defaults)
constructor - creates a new text track interface
Param | Type | Description |
---|---|---|
options | object |
overrides for default options |
defaults | object |
overrides for detault defaults |
Kewt
kewt.reset() ⇒ reset - resets all caption properties to their default values
Kind: instance method of Kewt
string
| object
kewt.get([property]) ⇒ get - gets the property, if specified, or all the properties
Kind: instance method of Kewt
Returns: string
| object
- the property, if specified, or all the properties
Param | Type | Description |
---|---|---|
[property] | string |
the property to get |
Kewt
kewt.set(property, [value]) ⇒ set - sets a property or properties
Kind: instance method of Kewt
Param | Type | Description |
---|---|---|
property | string | object |
the property to set |
[value] | string |
the value for the property if property is a string |
Kewt
kewt.setProperty(property, value) ⇒ setProperty - sets a property
Kind: instance method of Kewt
Param | Type | Description |
---|---|---|
property | string |
the property to set |
value | string |
the value for the property |
KewtDOM
Kind: global class
- KewtDOM
- new KewtDOM(options, defaults)
- .reset() ⇒
undefined
- .render() ⇒
undefined
- .persist() ⇒
undefined
new KewtDOM(options, defaults)
constructor - creates a new text track interface with DOM capabilities
Param | Type | Description |
---|---|---|
options | object |
overrides for default options |
defaults | object |
overrides for detault defaults |
undefined
kewtDOM.reset() ⇒ reset - resets all caption properties to their default values and clears persisted state
Kind: instance method of KewtDOM
undefined
kewtDOM.render() ⇒ render - renders the style tag with styles to document head
Kind: instance method of KewtDOM
undefined
kewtDOM.persist() ⇒ persist - persists the current Kewt state to localstorage
Kind: instance method of KewtDOM
Scripts
test
– run the tests
npm run test
coverage
– generate and view code coverage as HTML
npm run coverage
lint
– lint the codebase
npm run lint
readme
– generate the README
npm run readme
compile
– compile the code
npm run compile
License
MIT @ Flip