UNPKG

1.26 kBTypeScriptView Raw
1import { Disposable } from '../index';
2
3/**
4 * A singleton instance of this class available via atom.styles, which you can
5 * use to globally query and observe the set of active style sheets.
6 */
7export interface StyleManager {
8 // Event Subscription
9 /** Invoke callback for all current and future style elements. */
10 observeStyleElements(callback: (styleElement: StyleElementObservedEvent) => void): Disposable;
11
12 /** Invoke callback when a style element is added. */
13 onDidAddStyleElement(callback: (styleElement: StyleElementObservedEvent) => void): Disposable;
14
15 /** Invoke callback when a style element is removed. */
16 onDidRemoveStyleElement(callback: (styleElement: HTMLStyleElement) => void): Disposable;
17
18 /** Invoke callback when an existing style element is updated. */
19 onDidUpdateStyleElement(callback: (styleElement: StyleElementObservedEvent) => void): Disposable;
20
21 // Reading Style Elements
22 /** Get all loaded style elements. */
23 getStyleElements(): HTMLStyleElement[];
24
25 // Paths
26 /** Get the path of the user style sheet in ~/.atom. */
27 getUserStyleSheetPath(): string;
28}
29
30export interface StyleElementObservedEvent extends HTMLStyleElement {
31 sourcePath: string;
32 context: string;
33}