StyleManager
Summary
A singleton instance of this class available via AppEnv.styles
,
which you can use to globally query and observe the set of active style
sheets. The StyleManager
doesn't add any style elements to the DOM on its
own, but is instead subscribed to by individual <nylas-styles>
elements,
which clone and attach style elements in different contexts.
Instance Methods
observeStyleElements(callback)
Invoke `callback` for all current and future style elements.
Parameters
Argument | Description |
---|---|
callback | {Function} that is called with style elements. |
Returns
Return Values |
---|
Returns a {Disposable} on which `.dispose()` can be called to cancel the subscription. |
onDidAddStyleElement(callback)
Invoke `callback` when a style element is added.
Argument | Description |
---|---|
callback | {Function} that is called with style elements. |
Returns
Return Values |
---|
Returns a {Disposable} on which `.dispose()` can be called to cancel the subscription. |
onDidRemoveStyleElement(callback)
Invoke `callback` when a style element is removed.
Argument | Description |
---|---|
callback | {Function} that is called with style elements. |
Returns
Return Values |
---|
Returns a {Disposable} on which `.dispose()` can be called to cancel the subscription. |
onDidUpdateStyleElement(callback)
Invoke `callback` when an existing style element is updated.
Argument | Description |
---|---|
callback | {Function} that is called with style elements. |
Returns
Return Values |
---|
Returns a {Disposable} on which `.dispose()` can be called to cancel the subscription. |
getStyleElements()
Get all loaded style elements.