[Pkg-javascript-commits] [backbone] 26/34: adding docs for Model#fetch

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.1.2
in repository backbone.

commit c5c795ed98868d3e62fe9e7b3ad68891a0088b54
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Mon Oct 18 21:39:30 2010 -0400

    adding docs for Model#fetch
---
 index.html | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/index.html b/index.html
index 653e8c6..cc75db2 100644
--- a/index.html
+++ b/index.html
@@ -159,6 +159,7 @@
       <li>– <a href="#Model-cid">cid</a></li>
       <li>– <a href="#Model-attributes">attributes</a></li>
       <li>- <a href="#Model-toJSON">toJSON</a></li>
+      <li>– <a href="#Model-fetch">fetch</a></li>
       <li>– <a href="#Model-save">save</a></li>
       <li>– <a href="#Model-destroy">destroy</a></li>
       <li>– <a href="#Model-validate">validate</a></li>
@@ -567,6 +568,24 @@ artist.set({birthday: "December 16, 1866"});
 alert(JSON.stringify(artist));
 </pre>
 
+    <p id="Model-fetch">
+      <b class="header">fetch</b><code>model.fetch([options])</code>
+      <br />
+      Refreshes the model's state from the server. Useful if the model has never
+      been populated with data, or if you'd like to ensure that you have the
+      latest server state. A <tt>"change"</tt> event will be triggered if the
+      server's state differs from the current attributes. Accepts
+      <tt>success</tt> and <tt>error</tt> callbacks in the options hash, which
+      are passed <tt>(model, response)</tt> as arguments.
+    </p>
+    
+<pre>
+// Poll every 10 seconds to keep the channel model up-to-date.
+setInterval(function() {
+  channel.fetch();
+}, 10000);
+</pre>
+
     <p id="Model-save">
       <b class="header">save</b><code>model.save(attributes, [options])</code>
       <br />

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list