Constructor
# new App()
The main application file. You can import it as many times as you want,
and you will get the same instance
Members
Methods
# addCustomProperty(name, value, ctxopt)
Creates CustomProperty and keeps it in App instance
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string
|
The CSS property name | ||
value |
string
|
number
|
The CSS property value | ||
ctx |
HTMLElement
|
<optional> |
document.documentElement | The DOM Element style with apply to |
this
Example
import app from 'App';
app.addCustomProperty('hello', 'world');
# getCustomProperty(name) → {any}
Get CSS property from App instance
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
The CSS property name |
any
Example
import app from 'App';
app.getCustomProperty('hello');
# subscribeResize(name, handler)
Add handler to window resize event
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
The handler identifier |
handler |
fn
|
The callback to run on window resize |
this
Example
import app from 'App';
app.subscribeResize('my-resize-handler', () => {console.log('I'm listening to resize')});
# unsubscribeResize(name)
Removes handler from window resize event
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
The handler identifier |
this
Example
import app from 'App';
app.unsubscribeResize('my-resize-handler');