temple-backbone
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -5,3 +5,3 @@ /* | ||
* MIT License | ||
* Version 1.0.3 | ||
* Version 1.0.4 | ||
*/ | ||
@@ -97,3 +97,3 @@ | ||
setModel(model, index, false); | ||
this.set("length", col.length); | ||
self.set("length", col.length); | ||
model_cache.splice(index, 0, model); | ||
@@ -105,3 +105,3 @@ }, | ||
setModel(model, index, true); | ||
this.set("length", col.length); | ||
self.set("length", col.length); | ||
model_cache.splice(index, 1); | ||
@@ -116,3 +116,3 @@ }, | ||
addAllModels(); | ||
this.set("length", col.length); | ||
self.set("length", col.length); | ||
} | ||
@@ -126,6 +126,7 @@ }); | ||
get: function(col, path) { | ||
if (path === "length") return col.length; | ||
return col.at(path) || col.get(path); | ||
}, | ||
set: function(col, path, value) { | ||
return false; | ||
return true; | ||
}, | ||
@@ -132,0 +133,0 @@ keys: function(col) { |
@@ -1,1 +0,1 @@ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),(b.Temple||(b.Temple={})).Backbone=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c=function(){return this.Backbone?this.Backbone:a("backbone")}.call("undefined"!=typeof window?window:this),d=function(){return this.Temple?this.Temple:a("templejs")}.call("undefined"!=typeof window?window:this);b.exports=function(){this.handle(e),this.handle(f)};var e={match:function(a){return a instanceof c.Model},construct:function(a){this.listenTo(a,"change",function(){for(var b in a.changed)this.set(b,a.changed[b])})},isLeaf:function(){return!1},get:function(a,b){return a.get(b)},set:function(a,b,c){return a.set(b,c),!0},keys:function(a){return a.keys()},merge:function(a,b){if(!d.util.isPlainObject(b))return!1;for(var c in b)this.set(c,b[c]);return!0},deleteProperty:function(a,b){return a.unset(b),!0},destroy:function(a){this.stopListening(a)}},f={match:function(a){return a instanceof c.Collection},construct:function(a){function b(a,b,c){var e,f;c?(e="unset",f={remove:!0}):(e="set",f=a),d[e](b,f),d[e](a.cid,f),null!=a.id&&d[e](a.id,f)}function c(){var c=e=a.toArray();c.forEach(function(a,c){b(a,c,!1)})}var d=this,e=a.toArray();this.set("length",a.length),this.listenTo(a,{add:function(c){var d=a.indexOf(c);b(c,d,!1),this.set("length",a.length),e.splice(d,0,c)},remove:function(c){var d=e.indexOf(c);~d&&(b(c,d,!0),this.set("length",a.length),e.splice(d,1))},sort:c,reset:function(){e.forEach(function(a,c){b(a,c,!0)}),addAllModels(),this.set("length",a.length)}})},isLeaf:function(){return!1},toArray:function(a){return a.toArray()},get:function(a,b){return a.at(b)||a.get(b)},set:function(){return!1},keys:function(a){return Object.keys(a.toArray())},merge:function(){return!1},deleteProperty:function(a,b){var c=a.at(b)||a.get(b);return a.remove(c),!0},destroy:function(a){this.stopListening(a)}}},{templejs:"+QSU3/"}]},{},[1])(1)}); | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),(b.Temple||(b.Temple={})).Backbone=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c=function(){return this.Backbone?this.Backbone:a("backbone")}.call("undefined"!=typeof window?window:this),d=function(){return this.Temple?this.Temple:a("templejs")}.call("undefined"!=typeof window?window:this);b.exports=function(){this.handle(e),this.handle(f)};var e={match:function(a){return a instanceof c.Model},construct:function(a){this.listenTo(a,"change",function(){for(var b in a.changed)this.set(b,a.changed[b])})},isLeaf:function(){return!1},get:function(a,b){return a.get(b)},set:function(a,b,c){return a.set(b,c),!0},keys:function(a){return a.keys()},merge:function(a,b){if(!d.util.isPlainObject(b))return!1;for(var c in b)this.set(c,b[c]);return!0},deleteProperty:function(a,b){return a.unset(b),!0},destroy:function(a){this.stopListening(a)}},f={match:function(a){return a instanceof c.Collection},construct:function(a){function b(a,b,c){var e,f;c?(e="unset",f={remove:!0}):(e="set",f=a),d[e](b,f),d[e](a.cid,f),null!=a.id&&d[e](a.id,f)}function c(){var c=e=a.toArray();c.forEach(function(a,c){b(a,c,!1)})}var d=this,e=a.toArray();this.set("length",a.length),this.listenTo(a,{add:function(c){var f=a.indexOf(c);b(c,f,!1),d.set("length",a.length),e.splice(f,0,c)},remove:function(c){var f=e.indexOf(c);~f&&(b(c,f,!0),d.set("length",a.length),e.splice(f,1))},sort:c,reset:function(){e.forEach(function(a,c){b(a,c,!0)}),addAllModels(),d.set("length",a.length)}})},isLeaf:function(){return!1},toArray:function(a){return a.toArray()},get:function(a,b){return"length"===b?a.length:a.at(b)||a.get(b)},set:function(){return!0},keys:function(a){return Object.keys(a.toArray())},merge:function(){return!1},deleteProperty:function(a,b){var c=a.at(b)||a.get(b);return a.remove(c),!0},destroy:function(a){this.stopListening(a)}}},{templejs:"+QSU3/"}]},{},[1])(1)}); |
@@ -88,3 +88,3 @@ var Backbone = (function() { | ||
setModel(model, index, false); | ||
this.set("length", col.length); | ||
self.set("length", col.length); | ||
model_cache.splice(index, 0, model); | ||
@@ -96,3 +96,3 @@ }, | ||
setModel(model, index, true); | ||
this.set("length", col.length); | ||
self.set("length", col.length); | ||
model_cache.splice(index, 1); | ||
@@ -107,3 +107,3 @@ }, | ||
addAllModels(); | ||
this.set("length", col.length); | ||
self.set("length", col.length); | ||
} | ||
@@ -117,6 +117,7 @@ }); | ||
get: function(col, path) { | ||
if (path === "length") return col.length; | ||
return col.at(path) || col.get(path); | ||
}, | ||
set: function(col, path, value) { | ||
return false; | ||
return true; | ||
}, | ||
@@ -123,0 +124,0 @@ keys: function(col) { |
{ | ||
"name": "temple-backbone", | ||
"description": "Makes Temple more compatible with Backbone.", | ||
"version": "1.0.3", | ||
"description": "Adds Backbone specific handlers to Temple.", | ||
"version": "1.0.4", | ||
"author": "Beneath the Ink <info@beneaththeink.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
# Temple Bacbone | ||
Makes Temple more compatible with Backbone. | ||
Adds Backbone specific handlers to [Temple](https://github.com/BeneathTheInk/Temple). | ||
@@ -10,3 +10,2 @@ ## Install | ||
```html | ||
<script type="text/javascript" src="jquery.js"></script> | ||
<script type="text/javascript" src="underscore.js"></script> | ||
@@ -24,1 +23,8 @@ <script type="text/javascript" src="backbone.js"></script> | ||
To use this plugin, call `.use(Temple.Backbone)` on a Temple view or viewmodel. This will enable Backbone models and collections as a compatible data type. | ||
```javascript | ||
view.use(Temple.Backbone); | ||
view.set("bone", new Backbone.Model({ foo: "bar" })); | ||
view.get("foo"); // "bar" | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
565672
18100
29