2015-10-03 01:57:40 +08:00
---
layout: docs
title: StyleManager
2015-10-04 04:39:16 +08:00
edit_url: "https://github.com/nylas/N1/blob/master/src/style-manager.coffee"
2015-10-03 01:57:40 +08:00
---
2015-09-21 23:57:54 +08:00
2015-10-03 01:57:40 +08:00
< h2 > Summary< / h2 >
2015-09-21 23:57:54 +08:00
2015-10-03 01:57:40 +08:00
< div class = "markdown-from-sourecode" >
< p > < p > A singleton instance of this class available via < code > atom.styles< / code > ,
2015-09-21 23:57:54 +08:00
which you can use to globally query and observe the set of active style
sheets. The < code > StyleManager< / code > doesn' t add any style elements to the DOM on its
own, but is instead subscribed to by individual < code > < atom-styles> < / code > elements,
which clone and attach style elements in different contexts.< / p >
< / p >
2015-10-03 01:57:40 +08:00
< / div >
2015-09-21 23:57:54 +08:00
2015-10-03 01:57:40 +08:00
< ul >
< li > < a href = "#Event Subscription" > Event Subscription< / a > < / li >
< li > < a href = "#Reading Style Elements" > Reading Style Elements< / a > < / li >
< li > < a href = "#Paths" > Paths< / a > < / li >
< / ul >
2015-09-21 23:57:54 +08:00
2015-10-03 01:57:40 +08:00
< h3 > Instance Methods< / h3 >
2015-09-21 23:57:54 +08:00
2015-10-03 01:57:40 +08:00
< h4 id = observeStyleElements class = "function-name" >
observeStyleElements(< span class = "args" > < span class = "arg" > callback< / span > < / span > ) < a href = "#observeStyleElements" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Invoke < code > callback< / code > for all current and future style elements.< / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Parameters< / strong >
< table class = "arguments" >
2015-09-21 23:57:54 +08:00
< tr >
2015-10-03 01:57:40 +08:00
< th > Argument< / th >
< th > Description< / th >
2015-09-21 23:57:54 +08:00
< / tr >
< tr >
2015-10-03 01:57:40 +08:00
< td style = "width:15%;" >
< em > callback< / em >
< / td >
< td class = "markdown-from-sourecode" >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< p > < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/function' > Function< / a > that is called with style elements.< / p >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< / td >
2015-09-21 23:57:54 +08:00
< / tr >
2015-10-03 01:57:40 +08:00
< / table >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a {Disposable} on which < code > .dispose()< / code > can be called to cancel the
subscription.< / p >
< / td > < / tr >
< / table >
< h4 id = onDidAddStyleElement class = "function-name" >
onDidAddStyleElement(< span class = "args" > < span class = "arg" > callback< / span > < / span > ) < a href = "#onDidAddStyleElement" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Invoke < code > callback< / code > when a style element is added.< / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Parameters< / strong >
< table class = "arguments" >
2015-09-21 23:57:54 +08:00
< tr >
2015-10-03 01:57:40 +08:00
< th > Argument< / th >
< th > Description< / th >
2015-09-21 23:57:54 +08:00
< / tr >
< tr >
2015-10-03 01:57:40 +08:00
< td style = "width:15%;" >
< em > callback< / em >
< / td >
< td class = "markdown-from-sourecode" >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< p > < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/function' > Function< / a > that is called with style elements.< / p >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< / td >
2015-09-21 23:57:54 +08:00
< / tr >
2015-10-03 01:57:40 +08:00
< / table >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a {Disposable} on which < code > .dispose()< / code > can be called to cancel the
subscription.< / p >
< / td > < / tr >
< / table >
< h4 id = onDidRemoveStyleElement class = "function-name" >
onDidRemoveStyleElement(< span class = "args" > < span class = "arg" > callback< / span > < / span > ) < a href = "#onDidRemoveStyleElement" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Invoke < code > callback< / code > when a style element is removed.< / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Parameters< / strong >
< table class = "arguments" >
2015-09-21 23:57:54 +08:00
< tr >
2015-10-03 01:57:40 +08:00
< th > Argument< / th >
< th > Description< / th >
2015-09-21 23:57:54 +08:00
< / tr >
2015-10-03 01:57:40 +08:00
< tr >
< td style = "width:15%;" >
< em > callback< / em >
< / td >
< td class = "markdown-from-sourecode" >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< p > < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/function' > Function< / a > that is called with style elements.< / p >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< / table >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a {Disposable} on which < code > .dispose()< / code > can be called to cancel the
subscription.< / p >
< / td > < / tr >
< / table >
< h4 id = onDidUpdateStyleElement class = "function-name" >
onDidUpdateStyleElement(< span class = "args" > < span class = "arg" > callback< / span > < / span > ) < a href = "#onDidUpdateStyleElement" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Invoke < code > callback< / code > when an existing style element is updated.< / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Parameters< / strong >
< table class = "arguments" >
< tr >
< th > Argument< / th >
< th > Description< / th >
< / tr >
< tr >
< td style = "width:15%;" >
< em > callback< / em >
< / td >
< td class = "markdown-from-sourecode" >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< p > < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/function' > Function< / a > that is called with style elements.< / p >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< / table >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a {Disposable} on which < code > .dispose()< / code > can be called to cancel the
subscription.< / p >
< / td > < / tr >
< / table >
< h4 id = getStyleElements class = "function-name" >
getStyleElements(< span class = "args" > < / span > ) < a href = "#getStyleElements" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Get all loaded style elements. < / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< h4 id = getUserStyleSheetPath class = "function-name" >
getUserStyleSheetPath(< span class = "args" > < / span > ) < a href = "#getUserStyleSheetPath" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Get the path of the user style sheet in < code > ~/.atom< / code > .< / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string' > String< / a > .< / p >
< / td > < / tr >
< / table >