Mailspring/docs/DatabaseView.html

67 lines
2.2 KiB
HTML
Raw Normal View History

2015-10-03 01:57:40 +08:00
---
layout: docs
title: DatabaseView
2015-10-04 03:39:12 +08:00
edit_url: "https://github.com/nylas/N1/blob/master/src/flux/stores/database-view.coffee"
2015-10-03 01:57:40 +08:00
---
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
<h2>Summary</h2>
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
<div class="markdown-from-sourecode">
<p><p>DatabaseView abstracts away the process of paginating a query
2015-10-02 03:34:16 +08:00
and loading ranges of data. It&#39;s very smart about deciding when
results need to be refreshed. There are a few core concepts that
make it flexible:</p>
<p>metadataProvider: For each item loaded, you can provide a promise
that resolves with additional data for that item. The DatabaseView
will not consider the page of data &quot;loaded&quot; until all the metadata
promises have resolved. (Used for message metadata on threads)</p>
<p>retainedRange: The retained range ({start, end}) represents the
objects currently being displayed. React components displaying the
view can alter the retained range as the user scrolls.</p>
<p>Note: Do not make the retainedRange larger than you need. The
DatabaseView may internally keep a larger set of items loaded
for performance.</p>
</p>
</div>
2015-10-03 01:57:40 +08:00
<ul>
</ul>
<h3>Instance Methods</h3>
<h4 id=invalidate class="function-name">
invalidate(<span class="args"><span class="arg">options</span></span>) <a href="#invalidate" class="link"></a>
</h4>
2015-10-04 03:39:12 +08:00
2015-10-03 01:57:40 +08:00
<div class="function-description markdown-from-sourecode">
<p><p>Call this method when the DatabaseStore triggers and will impact the
data maintained by this DatabaseView. In the future, the DatabaseView will
probably observe the DatabaseView directly.</p>
<p>TODO: In order for the DatabaseView to monitor the DatabaseStore directly,
it needs to have some way of detatching it&#39;s listener when it&#39;s no longer needed!
Need a destructor...</p>
</p>
</div>
2015-10-04 03:39:12 +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>options</em>
</td>
<td class="markdown-from-sourecode">
2015-10-04 03:39:12 +08:00
2015-10-03 01:57:40 +08:00
<p>an Object with the following optional keys which can be used to optimize the behavior of the DatabaseView:</p>
2015-10-04 03:39:12 +08:00
2015-10-03 01:57:40 +08:00
</td>
</tr>
</table>