Mailspring/docs/StyleManager.html
2015-10-03 13:39:16 -07:00

201 lines
6.7 KiB
HTML

---
layout: docs
title: StyleManager
edit_url: "https://github.com/nylas/N1/blob/master/src/style-manager.coffee"
---
<h2>Summary</h2>
<div class="markdown-from-sourecode">
<p><p>A singleton instance of this class available via <code>atom.styles</code>,
which you can use to globally query and observe the set of active style
sheets. The <code>StyleManager</code> doesn&#39;t add any style elements to the DOM on its
own, but is instead subscribed to by individual <code>&lt;atom-styles&gt;</code> elements,
which clone and attach style elements in different contexts.</p>
</p>
</div>
<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>
<h3>Instance Methods</h3>
<h4 id=observeStyleElements class="function-name">
observeStyleElements(<span class="args"><span class="arg">callback</span></span>) <a href="#observeStyleElements" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p><p>Invoke <code>callback</code> for all current and future style elements.</p>
</p>
</div>
<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">
<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>
</td>
</tr>
</table>
<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>
<div class="function-description markdown-from-sourecode">
<p><p>Invoke <code>callback</code> when a style element is added.</p>
</p>
</div>
<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">
<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>
</td>
</tr>
</table>
<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>
<div class="function-description markdown-from-sourecode">
<p><p>Invoke <code>callback</code> when a style element is removed.</p>
</p>
</div>
<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">
<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>
</td>
</tr>
</table>
<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>
<div class="function-description markdown-from-sourecode">
<p><p>Invoke <code>callback</code> when an existing style element is updated.</p>
</p>
</div>
<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">
<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>
</td>
</tr>
</table>
<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>
<div class="function-description markdown-from-sourecode">
<p><p>Get all loaded style elements. </p>
</p>
</div>
<h4 id=getUserStyleSheetPath class="function-name">
getUserStyleSheetPath(<span class="args"></span>) <a href="#getUserStyleSheetPath" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p><p>Get the path of the user style sheet in <code>~/.atom</code>.</p>
</p>
</div>
<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>