[Pkg-javascript-commits] [backbone] 51/101: Backbone.Bindable -> Backbone.Events
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 16:58:28 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.1.0
in repository backbone.
commit cc48c76485d947b94e2331f9a89ae6c255bd1b7b
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Thu Oct 7 11:24:44 2010 -0400
Backbone.Bindable -> Backbone.Events
---
backbone.js | 10 ++--
docs/backbone.html | 10 ++--
index.html | 131 ++---------------------------------------------------
test/bindable.js | 6 +--
test/model.js | 2 +-
5 files changed, 19 insertions(+), 140 deletions(-)
diff --git a/backbone.js b/backbone.js
index 6e2d381..b71e859 100644
--- a/backbone.js
+++ b/backbone.js
@@ -32,7 +32,7 @@
return child;
};
- // Backbone.Bindable
+ // Backbone.Events
// -----------------
// A module that can be mixed in to *any object* in order to provide it with
@@ -40,11 +40,11 @@
// `trigger`-ing an event fires all callbacks in succession.
//
// var object = {};
- // _.extend(object, Backbone.Bindable);
+ // _.extend(object, Backbone.Events);
// object.bind('expand', function(){ alert('expanded'); });
// object.trigger('expand');
//
- Backbone.Bindable = {
+ Backbone.Events = {
// Bind an event, specified by a string name, `ev`, to a `callback` function.
// Passing `"all"` will bind the callback to all events fired.
@@ -114,7 +114,7 @@
};
// Attach all inheritable methods to the Model prototype.
- _.extend(Backbone.Model.prototype, Backbone.Bindable, {
+ _.extend(Backbone.Model.prototype, Backbone.Events, {
// A snapshot of the model's previous attributes, taken immediately
// after the last `changed` event was fired.
@@ -308,7 +308,7 @@
};
// Define the Collection's inheritable methods.
- _.extend(Backbone.Collection.prototype, Backbone.Bindable, {
+ _.extend(Backbone.Collection.prototype, Backbone.Events, {
model : Backbone.Model,
diff --git a/docs/backbone.html b/docs/backbone.html
index 4974c9d..a0268b3 100644
--- a/docs/backbone.html
+++ b/docs/backbone.html
@@ -14,14 +14,14 @@ static properties to be extended.</p> </td> <td class="c
<span class="k">if</span> <span class="p">(</span><span class="nx">classProps</span><span class="p">)</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">child</span><span class="p">,</span> <span class="nx">classProps</span><span class="p">);</span>
<span class="nx">child</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">constructor</span> <span class="o">=</span> <span class="nx">child</span><span class="p">;</span>
<span class="k">return</span> <span class="nx">child</span><span class="p">;</span>
- <span class="p">};</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">¶</a> </div> <h2>Backbone.Bindable</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="s [...]
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">¶</a> </div> <h2>Backbone.Events</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="sec [...]
custom events. You may <code>bind</code> or <code>unbind</code> a callback function to an event;
<code>trigger</code>-ing an event fires all callbacks in succession.</p>
-<pre><code>_.extend(object, Backbone.Bindable);
+<pre><code>_.extend(object, Backbone.Events);
object.bind('expand', function(){ alert('expanded'); });
object.trigger('expand');
-</code></pre> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">Backbone</span><span class="p">.</span><span class="nx">Bindable</span> <span class="o">=</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">¶</a> </div> [...]
+</code></pre> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">Backbone</span><span class="p">.</span><span class="nx">Events</span> <span class="o">=</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">¶</a> </div> [...]
Passing <code>"all"</code> will bind the callback to all events fired.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">bind</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">ev</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">calls</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_callbacks</span> <span class="o">||</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_callbacks</span> <span class="o">=</span> <span class="p">{});</span>
<span class="kd">var</span> <span class="nx">list</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_callbacks</span><span class="p">[</span><span class="nx">ev</span><span class="p">]</span> <span class="o">||</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_callbacks</span><span class="p">[</span><span class="nx">ev</span><span class="p">]</span> <span class="o">=</span> <span cl [...]
@@ -67,7 +67,7 @@ If you do not specify the id, a negative id will be assigned for you.</p>
<span class="k">this</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="nx">attributes</span><span class="p">,</span> <span class="p">{</span><span class="nx">silent</span> <span class="o">:</span> <span class="kc">true</span><span class="p">});</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cid</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">uniqueId</span><span class="p">(</span><span class="s1">'c'</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">_formerAttributes</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">attributes</span><span class="p">();</span>
- <span class="p">};</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">¶</a> </div> <p>Attach all inheritable methods to the Model prototype.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">_</span><span class="p">.</spa [...]
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">¶</a> </div> <p>Attach all inheritable methods to the Model prototype.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">_</span><span class="p">.</spa [...]
after the last <code>changed</code> event was fired.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">_formerAttributes</span> <span class="o">:</span> <span class="kc">null</span><span class="p">,</span></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-16"> [...]
<span class="k">return</span> <span class="nx">_</span><span class="p">.</span><span class="nx">clone</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_attributes</span><span class="p">);</span>
<span class="p">},</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-18">¶</a> </div> <p>Default URL for the model's representation on the server -- if you're
@@ -184,7 +184,7 @@ its models in sort order, as they're added and removed.</p> </td>
<span class="k">this</span><span class="p">.</span><span class="nx">_boundOnModelChange</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onModelChange</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">_initialize</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">models</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">refresh</span><span class="p">(</span><span class="nx">models</span><span class="p">,</span><span class="kc">true</span><span class="p">);</span>
- <span class="p">};</span></pre></div> </td> </tr> <tr id="section-35"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-35">¶</a> </div> <p>Define the Collection's inheritable methods.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">_</span><span class="p">.</span><span cl [...]
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-35"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-35">¶</a> </div> <p>Define the Collection's inheritable methods.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">_</span><span class="p">.</span><span cl [...]
<span class="nx">model</span> <span class="o">:</span> <span class="nx">Backbone</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span></pre></div> </td> </tr> <tr id="section-36"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-36">¶</a> </div> <p>Override this function to get convenient logging in the c [...]
<span class="k">return</span> <span class="s1">'Collection ('</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">length</span> <span class="o">+</span> <span class="s2">" models)"</span><span class="p">;</span>
diff --git a/index.html b/index.html
index 3dfd5e4..c03c1e5 100644
--- a/index.html
+++ b/index.html
@@ -98,8 +98,8 @@
}
pre {
font-size: 12px;
- padding: 2px 0 2px 12px;
- border-left: 6px solid black;
+ padding: 2px 0 2px 15px;
+ border-left: 2px solid #bbb;
margin: 0px 0 30px;
}
#diagram {
@@ -111,7 +111,7 @@
<div class="toc interface">
<div class="toc_title">
- Bindable
+ Events
</div>
<ul class="toc_section">
<li>– <span>bind</span></li>
@@ -128,6 +128,7 @@
<li>– <span>attributes</span></li>
<li>– <span>save</span></li>
<li>– <span>destroy</span></li>
+ <li>– <span>validate</span></li>
<li>– <span>url</span></li>
<li>– <span>clone</span></li>
<li>– <span>toString</span></li>
@@ -742,130 +743,8 @@ JST['common/menu']</pre>
<h2 id="changes">Change Log</h2>
<p>
- <b class="header">0.5.3</b><br />
- You can now embed <b>WOFF</b>-formatted fonts.
- Jammit warnings avoid use of <tt>Rails.logger</tt>.
- Bugfixes for Ruby 1.9.2 with asset files containing Unicode characters.
- </p>
-
- <p>
- <b class="header">0.5.1</b><br />
- Included missing <tt>rails/routes.rb</tt> file in the Gem manifest for Rails 3.
- </p>
-
- <p>
- <b class="header">0.5.0</b><br />
- The Jammit gem is now compatible with Rails 3. JST template packages are
- no longer specified separately. This is a backwards-incompatible change,
- and you'll have to update your <tt>assets.yml</tt> file to simply include
- the JST in your existing JavaScript packages, as shown above. Alongside
- this change, template names are now better namespaced — see the
- section on <b>JavaScript Templates</b> for the details.
- Bugfix for IE8 and Data-URIs slightly under 32kb in size, as well as
- for MHTML in IE7-mode in Vista.
- </p>
-
- <p>
- <b class="header">0.4.4</b><br />
- Jammit will now add the <tt>RAILS_ASSET_ID</tt> timestamp to image URLs
- within your CSS packages, if configured, for better cache-busting.
- <a href="http://github.com/ghazel/">Greg Hazel</a> contributed a series
- of Jammit/Windows bug fixes.
- </p>
-
- <p>
- <b class="header">0.4.3</b><br />
- Bugfix for building on Windows with drive-letter absolute paths.
- </p>
-
- <p>
- <b class="header">0.4.2</b><br />
- Added a logged warning when you have rules in <b>assets.yml</b> that don't
- match any files.
- </p>
-
- <p>
- <b class="header">0.4.1</b><br />
- Jammit is now able to embed <tt>@font-face</tt> web fonts in <b>TTF</b> and
- <b>OTF</b> formats. The <b>embed_images</b> option has been renamed to
- <b>embed_assets</b> for this change. The <b>assets.yml</b> file is now
- passed through ERB before being loaded, so you can configure
- environment-specific settings, just like you would with <b>database.yml</b>.
- </p>
-
- <p>
- <b class="header">0.3.3</b><br />
- Added <tt>css_compressor_options</tt> to assets.yml, so you can
- set <tt>charset</tt> and <tt>line_break</tt> for the YUI CSS Compressor.
- </p>
-
- <p>
- <b class="header">0.3.2</b><br />
- If Java isn't available on your machine, Jammit will now run in a graceful
- degraded mode, where assets are packaged but not compressed. You can now
- pass <tt>:embed_assets => false</tt> to the <tt>include_stylesheets</tt>
- helper to disable image embedding on a per-package basis.
- </p>
-
- <p>
- <b class="header">0.2.8</b><br />
- Jammit now correctly rewrites relative image URLs within CSS, for easier
- integration with partial Rails apps deployed on sub-paths.
- </p>
-
- <p>
- <b class="header">0.2.7</b><br />
- The <tt>jammit</tt> command has been enhanced to check the modification times of
- your packages — if no source files have changed, the package isn't
- rebuilt.
- </p>
-
- <p>
- <b class="header">0.2.6</b><br />
- Jammit now raises an exception if Java isn't installed, or if the Java
- version is unsupported by your JavaScript compressor of choice.
- </p>
-
- <p>
- <b class="header">0.2.5</b><br />
- When specifying your asset packages as directory globs, absolute globs are
- now absolute, and relative globs are relative to RAILS_ROOT.
- </p>
-
- <p>
- <b class="header">0.2.4</b><br />
- Jammit now throws a <tt>ConfigurationNotFound</tt> error when attempting to load
- a nonexistent configuration file. Resolved an issue with asset caching from
- daemonized mongrels.
- </p>
-
- <p>
- <b class="header">0.2.1</b><br />
- The <tt>include_stylesheets</tt> helper now takes the same options as the
- Rails <tt>stylesheet_link_tag</tt> helper (such as <tt>:media => 'print'</tt>).
- </p>
-
- <p>
- <b class="header">0.2.0</b><br />
- Jammit now supports the <b>Google Closure Compiler</b> as an alternative
- to the YUI compressor.
- </p>
-
- <p>
- <b class="header">0.1.3</b><br />
- Fixed a bug that conflicted with other plugins trying to alter
- ApplicationController in development.
- </p>
-
- <p>
- <b class="header">0.1.1</b><br />
- Added support for embedding images with stylesheet-relative paths.
- Shortened the MHTML identifiers.
- </p>
-
- <p>
<b class="header">0.1.0</b><br />
- Initial Jammit release.
+ Initial Backbone release.
</p>
<p>
diff --git a/test/bindable.js b/test/bindable.js
index 2c53699..1d92bfa 100644
--- a/test/bindable.js
+++ b/test/bindable.js
@@ -4,7 +4,7 @@ $(document).ready(function() {
test("bindable: bind and trigger", function() {
var obj = { counter: 0 };
- _.extend(obj,Backbone.Bindable);
+ _.extend(obj,Backbone.Events);
obj.bind('event', function() { obj.counter += 1; });
obj.trigger('event');
equals(obj.counter,1,'counter should be incremented.');
@@ -17,7 +17,7 @@ $(document).ready(function() {
test("bindable: bind, then unbind all functions", function() {
var obj = { counter: 0 };
- _.extend(obj,Backbone.Bindable);
+ _.extend(obj,Backbone.Events);
var callback = function() { obj.counter += 1; };
obj.bind('event', callback);
obj.trigger('event');
@@ -28,7 +28,7 @@ $(document).ready(function() {
test("bindable: bind two callbacks, unbind only one", function() {
var obj = { counterA: 0, counterB: 0 };
- _.extend(obj,Backbone.Bindable);
+ _.extend(obj,Backbone.Events);
var callback = function() { obj.counterA += 1; };
obj.bind('event', callback);
obj.bind('event', function() { obj.counterB += 1; });
diff --git a/test/model.js b/test/model.js
index 92b2e42..c279766 100644
--- a/test/model.js
+++ b/test/model.js
@@ -125,7 +125,7 @@ $(document).ready(function() {
model.validate = function(attrs) {
if (attrs.admin) return "Can't change admin status.";
};
- model.bind('error', function(error) {
+ model.bind('error', function(model, error) {
lastError = error;
});
var result = model.set({a: 100});
--
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