Skip to content

Commit

Permalink
docs: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyfrc committed Apr 14, 2024
1 parent 1e8a370 commit df6888e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/api/observable_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ appStore.register('posts/fetchAll/error', (state, payload) => {

// Fetch all posts
appStore.fetch('posts/fetchAll');

// Subscribe to updates
appStore.subscribe(newState => {
console.log('New state:', newState);
});
```
<a name="ObservableStore.fetch"></a>

Expand Down Expand Up @@ -202,6 +207,11 @@ appStore.register('posts/fetchAll/error', (state, payload) => {

// Fetch all posts
appStore.fetch('posts/fetchAll');

// Subscribe to updates
appStore.subscribe(newState => {
console.log('New state:', newState);
});
```
<a name="ObservableStore.invalidateQueries"></a>

Expand Down
10 changes: 10 additions & 0 deletions site/api/observable_store/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,11 @@ <h3 id="observablestorequeryqueryname-config">ObservableStore.query(queryName, c
</span><span id="__span-3-26"><a id="__codelineno-3-26" name="__codelineno-3-26" href="#__codelineno-3-26"></a>
</span><span id="__span-3-27"><a id="__codelineno-3-27" name="__codelineno-3-27" href="#__codelineno-3-27"></a><span class="c1">// Fetch all posts</span>
</span><span id="__span-3-28"><a id="__codelineno-3-28" name="__codelineno-3-28" href="#__codelineno-3-28"></a><span class="nx">appStore</span><span class="p">.</span><span class="nx">fetch</span><span class="p">(</span><span class="s1">&#39;posts/fetchAll&#39;</span><span class="p">);</span>
</span><span id="__span-3-29"><a id="__codelineno-3-29" name="__codelineno-3-29" href="#__codelineno-3-29"></a>
</span><span id="__span-3-30"><a id="__codelineno-3-30" name="__codelineno-3-30" href="#__codelineno-3-30"></a><span class="c1">// Subscribe to updates</span>
</span><span id="__span-3-31"><a id="__codelineno-3-31" name="__codelineno-3-31" href="#__codelineno-3-31"></a><span class="nx">appStore</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="nx">newState</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-32"><a id="__codelineno-3-32" name="__codelineno-3-32" href="#__codelineno-3-32"></a><span class="w"> </span><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;New state:&#39;</span><span class="p">,</span><span class="w"> </span><span class="nx">newState</span><span class="p">);</span>
</span><span id="__span-3-33"><a id="__codelineno-3-33" name="__codelineno-3-33" href="#__codelineno-3-33"></a><span class="p">});</span>
</span></code></pre></div>
<a name="ObservableStore.fetch"></a></p>
<h3 id="observablestorefetchqueryname-args-promiseany">ObservableStore.fetch(queryName, ...args) ⇒ <code>Promise.&lt;any&gt;</code></h3>
Expand Down Expand Up @@ -1784,6 +1789,11 @@ <h3 id="observablestorefetchqueryname-args-promiseany">ObservableStore.fetch(que
</span><span id="__span-4-26"><a id="__codelineno-4-26" name="__codelineno-4-26" href="#__codelineno-4-26"></a>
</span><span id="__span-4-27"><a id="__codelineno-4-27" name="__codelineno-4-27" href="#__codelineno-4-27"></a><span class="c1">// Fetch all posts</span>
</span><span id="__span-4-28"><a id="__codelineno-4-28" name="__codelineno-4-28" href="#__codelineno-4-28"></a><span class="nx">appStore</span><span class="p">.</span><span class="nx">fetch</span><span class="p">(</span><span class="s1">&#39;posts/fetchAll&#39;</span><span class="p">);</span>
</span><span id="__span-4-29"><a id="__codelineno-4-29" name="__codelineno-4-29" href="#__codelineno-4-29"></a>
</span><span id="__span-4-30"><a id="__codelineno-4-30" name="__codelineno-4-30" href="#__codelineno-4-30"></a><span class="c1">// Subscribe to updates</span>
</span><span id="__span-4-31"><a id="__codelineno-4-31" name="__codelineno-4-31" href="#__codelineno-4-31"></a><span class="nx">appStore</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="nx">newState</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-4-32"><a id="__codelineno-4-32" name="__codelineno-4-32" href="#__codelineno-4-32"></a><span class="w"> </span><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;New state:&#39;</span><span class="p">,</span><span class="w"> </span><span class="nx">newState</span><span class="p">);</span>
</span><span id="__span-4-33"><a id="__codelineno-4-33" name="__codelineno-4-33" href="#__codelineno-4-33"></a><span class="p">});</span>
</span></code></pre></div>
<a name="ObservableStore.invalidateQueries"></a></p>
<h3 id="observablestoreinvalidatequeriesqueryname">ObservableStore.invalidateQueries(queryName)</h3>
Expand Down
2 changes: 1 addition & 1 deletion site/search/search_index.json

Large diffs are not rendered by default.

Binary file modified site/sitemap.xml.gz
Binary file not shown.
10 changes: 10 additions & 0 deletions src/observables/observable-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ class ObservableStore extends Observable {
*
* // Fetch all posts
* appStore.fetch('posts/fetchAll');
*
* // Subscribe to updates
* appStore.subscribe(newState => {
* console.log('New state:', newState);
* });
* ```
*/
query(queryName, config) {
Expand Down Expand Up @@ -318,6 +323,11 @@ class ObservableStore extends Observable {
*
* // Fetch all posts
* appStore.fetch('posts/fetchAll');
*
* // Subscribe to updates
* appStore.subscribe(newState => {
* console.log('New state:', newState);
* });
* ```
*/
fetch(queryName, ...args) {
Expand Down

0 comments on commit df6888e

Please sign in to comment.