StyleManager Extended

A singleton instance of this class available via atom.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 <atom-styles> elements, which clone and attach style elements in different contexts.

Event Subscription

This section only has Extended methods.

Extended Methods

::observeStyleElements(callback)

Invoke callback for all current and future style elements.

Argument Description

callback

Function that is called with style elements.

styleElement

An HTMLStyleElement instance. The .sheet property will be null because this element isn’t attached to the DOM. If you want to attach this element to the DOM, be sure to clone it first by calling .cloneNode(true) on it. The style element will also have the following non-standard properties:

sourcePath

A String containing the path from which the style element was loaded.

context

A String indicating the target context of the style element.

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.

styleElement

An HTMLStyleElement instance. The .sheet property will be null because this element isn’t attached to the DOM. If you want to attach this element to the DOM, be sure to clone it first by calling .cloneNode(true) on it. The style element will also have the following non-standard properties:

sourcePath

A String containing the path from which the style element was loaded.

context

A String indicating the target context of the style element.

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.

styleElement

An HTMLStyleElement instance.

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.

styleElement

An HTMLStyleElement instance. The .sheet property will be null because this element isn’t attached to the DOM. The style element will also have the following non-standard properties:

sourcePath

A String containing the path from which the style element was loaded.

context

A String indicating the target context of the style element.

Return values

Returns a Disposable on which .dispose() can be called to cancel the subscription.

Reading Style Elements

This section only has Extended methods.

Extended Methods

::getStyleElements()

Get all loaded style elements.

Paths

This section only has Extended methods.

Extended Methods

::getUserStyleSheetPath()

Get the path of the user style sheet in ~/.atom.

Return values

Returns a String.