mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-13 14:55:54 +10:00
add backbone.babysitter
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
// Backbone.BabySitter
|
||||
// -------------------
|
||||
// v0.1.1
|
||||
//
|
||||
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
||||
// Distributed under MIT license
|
||||
//
|
||||
// http://github.com/marionettejs/backbone.babysitter
|
||||
|
||||
(function(root, factory) {
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['exports', 'backbone', 'underscore'], function(exports, Backbone, _) {
|
||||
return factory(Backbone, _);
|
||||
});
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
var Backbone = require('backbone');
|
||||
var _ = require('underscore');
|
||||
module.exports = factory(Backbone, _);
|
||||
} else {
|
||||
factory(root.Backbone, root._);
|
||||
}
|
||||
|
||||
}(this, function(Backbone, _) {
|
||||
"use strict";
|
||||
|
||||
// BabySitter.ChildViewContainer
|
||||
// -----------------------------
|
||||
//
|
||||
// Provide a container to store, retrieve and
|
||||
// shut down child views.
|
||||
|
||||
Backbone.ChildViewContainer = (function (Backbone, _) {
|
||||
|
||||
// Container Constructor
|
||||
// ---------------------
|
||||
|
||||
var Container = function(views){
|
||||
this._views = {};
|
||||
this._indexByModel = {};
|
||||
this._indexByCustom = {};
|
||||
this._updateLength();
|
||||
|
||||
_.each(views, this.add, this);
|
||||
};
|
||||
|
||||
// Container Methods
|
||||
// -----------------
|
||||
|
||||
_.extend(Container.prototype, {
|
||||
|
||||
// Add a view to this container. Stores the view
|
||||
// by `cid` and makes it searchable by the model
|
||||
// cid (and model itself). Optionally specify
|
||||
// a custom key to store an retrieve the view.
|
||||
add: function(view, customIndex){
|
||||
var viewCid = view.cid;
|
||||
|
||||
// store the view
|
||||
this._views[viewCid] = view;
|
||||
|
||||
// index it by model
|
||||
if (view.model){
|
||||
this._indexByModel[view.model.cid] = viewCid;
|
||||
}
|
||||
|
||||
// index by custom
|
||||
if (customIndex){
|
||||
this._indexByCustom[customIndex] = viewCid;
|
||||
}
|
||||
|
||||
this._updateLength();
|
||||
return this;
|
||||
},
|
||||
|
||||
// Find a view by the model that was attached to
|
||||
// it. Uses the model's `cid` to find it.
|
||||
findByModel: function(model){
|
||||
return this.findByModelCid(model.cid);
|
||||
},
|
||||
|
||||
// Find a view by the `cid` of the model that was attached to
|
||||
// it. Uses the model's `cid` to find the view `cid` and
|
||||
// retrieve the view using it.
|
||||
findByModelCid: function(modelCid){
|
||||
var viewCid = this._indexByModel[modelCid];
|
||||
return this.findByCid(viewCid);
|
||||
},
|
||||
|
||||
// Find a view by a custom indexer.
|
||||
findByCustom: function(index){
|
||||
var viewCid = this._indexByCustom[index];
|
||||
return this.findByCid(viewCid);
|
||||
},
|
||||
|
||||
// Find by index. This is not guaranteed to be a
|
||||
// stable index.
|
||||
findByIndex: function(index){
|
||||
return _.values(this._views)[index];
|
||||
},
|
||||
|
||||
// retrieve a view by its `cid` directly
|
||||
findByCid: function(cid){
|
||||
return this._views[cid];
|
||||
},
|
||||
|
||||
// Remove a view
|
||||
remove: function(view){
|
||||
var viewCid = view.cid;
|
||||
|
||||
// delete model index
|
||||
if (view.model){
|
||||
delete this._indexByModel[view.model.cid];
|
||||
}
|
||||
|
||||
// delete custom index
|
||||
_.any(this._indexByCustom, function(cid, key) {
|
||||
if (cid === viewCid) {
|
||||
delete this._indexByCustom[key];
|
||||
return true;
|
||||
}
|
||||
}, this);
|
||||
|
||||
// remove the view from the container
|
||||
delete this._views[viewCid];
|
||||
|
||||
// update the length
|
||||
this._updateLength();
|
||||
return this;
|
||||
},
|
||||
|
||||
// Call a method on every view in the container,
|
||||
// passing parameters to the call method one at a
|
||||
// time, like `function.call`.
|
||||
call: function(method){
|
||||
this.apply(method, _.tail(arguments));
|
||||
},
|
||||
|
||||
// Apply a method on every view in the container,
|
||||
// passing parameters to the call method one at a
|
||||
// time, like `function.apply`.
|
||||
apply: function(method, args){
|
||||
_.each(this._views, function(view){
|
||||
if (_.isFunction(view[method])){
|
||||
view[method].apply(view, args || []);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Update the `.length` attribute on this container
|
||||
_updateLength: function(){
|
||||
this.length = _.size(this._views);
|
||||
}
|
||||
});
|
||||
|
||||
// Borrowing this code from Backbone.Collection:
|
||||
// http://backbonejs.org/docs/backbone.html#section-106
|
||||
//
|
||||
// Mix in methods from Underscore, for iteration, and other
|
||||
// collection related features.
|
||||
var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
|
||||
'select', 'reject', 'every', 'all', 'some', 'any', 'include',
|
||||
'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
|
||||
'last', 'without', 'isEmpty', 'pluck'];
|
||||
|
||||
_.each(methods, function(method) {
|
||||
Container.prototype[method] = function() {
|
||||
var views = _.values(this._views);
|
||||
var args = [views].concat(_.toArray(arguments));
|
||||
return _[method].apply(_, args);
|
||||
};
|
||||
});
|
||||
|
||||
// return the public API
|
||||
return Container;
|
||||
})(Backbone, _);
|
||||
|
||||
return Backbone.ChildViewContainer;
|
||||
|
||||
}));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib/backbone.babysitter.min.js","sources":["?"],"names":["root","factory","define","amd","exports","Backbone","_","require","module","this","ChildViewContainer","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray"],"mappings":"CASC,SAASA,EAAMC,GAEd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,UAAW,WAAY,cAAe,SAASE,EAASC,EAAUC,GACxE,MAAOL,GAAQI,EAAUC,SAEtB,IAAuB,mBAAZF,SAAyB,CACzC,GAAIC,GAAWE,QAAQ,YACnBD,EAAIC,QAAQ,aAChBC,QAAOJ,QAAUH,EAAQI,EAAUC,OAEnCL,GAAQ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EAAEqC,WAAWtB,EAAKiB,KACpBjB,EAAKiB,GAAQC,MAAMlB,EAAMqB,UAM/B1B,cAAe,WACbP,KAAKmC,OAAStC,EAAEuC,KAAKpC,KAAKI,UAS9B,IAAIiC,IAAW,UAAW,OAAQ,MAAO,OAAQ,SAAU,SACzD,SAAU,SAAU,QAAS,MAAO,OAAQ,MAAO,UACnD,WAAY,SAAU,UAAW,QAAS,UAAW,OACrD,OAAQ,UAAW,UAAW,QAWhC,OATAxC,GAAEW,KAAK6B,EAAS,SAASR,GACvB3B,EAAUS,UAAUkB,GAAU,WAC5B,GAAI1B,GAAQN,EAAE2B,OAAOxB,KAAKI,QACtB6B,GAAQ9B,GAAOmC,OAAOzC,EAAE0C,QAAQP,WACpC,OAAOnC,GAAEgC,GAAQC,MAAMjC,EAAGoC,MAKvB/B,GACNN,EAAUC,GAEND,EAASK"}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Backbone.BabySitter
|
||||
// -------------------
|
||||
// v0.1.1
|
||||
//
|
||||
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
||||
// Distributed under MIT license
|
||||
//
|
||||
// http://github.com/marionettejs/backbone.babysitter
|
||||
|
||||
(function(e,i){if("function"==typeof define&&define.amd)define(["exports","backbone","underscore"],function(e,t,n){return i(t,n)});else if("undefined"!=typeof exports){var t=require("backbone"),n=require("underscore");module.exports=i(t,n)}else i(e.Backbone,e._)})(this,function(e,i){"use strict";return e.ChildViewContainer=function(e,i){var t=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),i.each(e,this.add,this)};i.extend(t.prototype,{add:function(e,i){var t=e.cid;return this._views[t]=e,e.model&&(this._indexByModel[e.model.cid]=t),i&&(this._indexByCustom[i]=t),this._updateLength(),this},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var i=this._indexByModel[e];return this.findByCid(i)},findByCustom:function(e){var i=this._indexByCustom[e];return this.findByCid(i)},findByIndex:function(e){return i.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){var t=e.cid;return e.model&&delete this._indexByModel[e.model.cid],i.any(this._indexByCustom,function(e,i){return e===t?(delete this._indexByCustom[i],!0):void 0},this),delete this._views[t],this._updateLength(),this},call:function(e){this.apply(e,i.tail(arguments))},apply:function(e,t){i.each(this._views,function(n){i.isFunction(n[e])&&n[e].apply(n,t||[])})},_updateLength:function(){this.length=i.size(this._views)}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return i.each(n,function(e){t.prototype[e]=function(){var t=i.values(this._views),n=[t].concat(i.toArray(arguments));return i[e].apply(i,n)}}),t}(e,i),e.ChildViewContainer});
|
||||
//@ sourceMappingURL=backbone.babysitter.map
|
||||
@@ -0,0 +1,189 @@
|
||||
// Backbone.BabySitter
|
||||
// -------------------
|
||||
// v0.1.2
|
||||
//
|
||||
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
||||
// Distributed under MIT license
|
||||
//
|
||||
// http://github.com/marionettejs/backbone.babysitter
|
||||
|
||||
(function(root, factory) {
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['exports', 'backbone', 'underscore'], function(exports, Backbone, _) {
|
||||
return factory(Backbone, _);
|
||||
});
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
var Backbone = require('backbone');
|
||||
var _ = require('underscore');
|
||||
module.exports = factory(Backbone, _);
|
||||
} else {
|
||||
factory(root.Backbone, root._);
|
||||
}
|
||||
|
||||
}(this, function(Backbone, _) {
|
||||
"use strict";
|
||||
|
||||
var previousChildViewContainer = Backbone.ChildViewContainer;
|
||||
|
||||
// BabySitter.ChildViewContainer
|
||||
// -----------------------------
|
||||
//
|
||||
// Provide a container to store, retrieve and
|
||||
// shut down child views.
|
||||
|
||||
Backbone.ChildViewContainer = (function (Backbone, _) {
|
||||
|
||||
// Container Constructor
|
||||
// ---------------------
|
||||
|
||||
var Container = function(views){
|
||||
this._views = {};
|
||||
this._indexByModel = {};
|
||||
this._indexByCustom = {};
|
||||
this._updateLength();
|
||||
|
||||
_.each(views, this.add, this);
|
||||
};
|
||||
|
||||
// Container Methods
|
||||
// -----------------
|
||||
|
||||
_.extend(Container.prototype, {
|
||||
|
||||
// Add a view to this container. Stores the view
|
||||
// by `cid` and makes it searchable by the model
|
||||
// cid (and model itself). Optionally specify
|
||||
// a custom key to store an retrieve the view.
|
||||
add: function(view, customIndex){
|
||||
var viewCid = view.cid;
|
||||
|
||||
// store the view
|
||||
this._views[viewCid] = view;
|
||||
|
||||
// index it by model
|
||||
if (view.model){
|
||||
this._indexByModel[view.model.cid] = viewCid;
|
||||
}
|
||||
|
||||
// index by custom
|
||||
if (customIndex){
|
||||
this._indexByCustom[customIndex] = viewCid;
|
||||
}
|
||||
|
||||
this._updateLength();
|
||||
return this;
|
||||
},
|
||||
|
||||
// Find a view by the model that was attached to
|
||||
// it. Uses the model's `cid` to find it.
|
||||
findByModel: function(model){
|
||||
return this.findByModelCid(model.cid);
|
||||
},
|
||||
|
||||
// Find a view by the `cid` of the model that was attached to
|
||||
// it. Uses the model's `cid` to find the view `cid` and
|
||||
// retrieve the view using it.
|
||||
findByModelCid: function(modelCid){
|
||||
var viewCid = this._indexByModel[modelCid];
|
||||
return this.findByCid(viewCid);
|
||||
},
|
||||
|
||||
// Find a view by a custom indexer.
|
||||
findByCustom: function(index){
|
||||
var viewCid = this._indexByCustom[index];
|
||||
return this.findByCid(viewCid);
|
||||
},
|
||||
|
||||
// Find by index. This is not guaranteed to be a
|
||||
// stable index.
|
||||
findByIndex: function(index){
|
||||
return _.values(this._views)[index];
|
||||
},
|
||||
|
||||
// retrieve a view by its `cid` directly
|
||||
findByCid: function(cid){
|
||||
return this._views[cid];
|
||||
},
|
||||
|
||||
// Remove a view
|
||||
remove: function(view){
|
||||
var viewCid = view.cid;
|
||||
|
||||
// delete model index
|
||||
if (view.model){
|
||||
delete this._indexByModel[view.model.cid];
|
||||
}
|
||||
|
||||
// delete custom index
|
||||
_.any(this._indexByCustom, function(cid, key) {
|
||||
if (cid === viewCid) {
|
||||
delete this._indexByCustom[key];
|
||||
return true;
|
||||
}
|
||||
}, this);
|
||||
|
||||
// remove the view from the container
|
||||
delete this._views[viewCid];
|
||||
|
||||
// update the length
|
||||
this._updateLength();
|
||||
return this;
|
||||
},
|
||||
|
||||
// Call a method on every view in the container,
|
||||
// passing parameters to the call method one at a
|
||||
// time, like `function.call`.
|
||||
call: function(method){
|
||||
this.apply(method, _.tail(arguments));
|
||||
},
|
||||
|
||||
// Apply a method on every view in the container,
|
||||
// passing parameters to the call method one at a
|
||||
// time, like `function.apply`.
|
||||
apply: function(method, args){
|
||||
_.each(this._views, function(view){
|
||||
if (_.isFunction(view[method])){
|
||||
view[method].apply(view, args || []);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Update the `.length` attribute on this container
|
||||
_updateLength: function(){
|
||||
this.length = _.size(this._views);
|
||||
}
|
||||
});
|
||||
|
||||
// Borrowing this code from Backbone.Collection:
|
||||
// http://backbonejs.org/docs/backbone.html#section-106
|
||||
//
|
||||
// Mix in methods from Underscore, for iteration, and other
|
||||
// collection related features.
|
||||
var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
|
||||
'select', 'reject', 'every', 'all', 'some', 'any', 'include',
|
||||
'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
|
||||
'last', 'without', 'isEmpty', 'pluck'];
|
||||
|
||||
_.each(methods, function(method) {
|
||||
Container.prototype[method] = function() {
|
||||
var views = _.values(this._views);
|
||||
var args = [views].concat(_.toArray(arguments));
|
||||
return _[method].apply(_, args);
|
||||
};
|
||||
});
|
||||
|
||||
// return the public API
|
||||
return Container;
|
||||
})(Backbone, _);
|
||||
|
||||
Backbone.ChildViewContainer.VERSION = '0.1.2';
|
||||
|
||||
Backbone.ChildViewContainer.noConflict = function () {
|
||||
Backbone.ChildViewContainer = previousChildViewContainer;
|
||||
return this;
|
||||
};
|
||||
|
||||
return Backbone.ChildViewContainer;
|
||||
|
||||
}));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib/backbone.babysitter.min.js","sources":["?"],"names":["root","factory","define","amd","exports","Backbone","_","require","module","this","previousChildViewContainer","ChildViewContainer","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray","VERSION","noConflict"],"mappings":"CASC,SAASA,EAAMC,GAEd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,UAAW,WAAY,cAAe,SAASE,EAASC,EAAUC,GACxE,MAAOL,GAAQI,EAAUC,SAEtB,IAAuB,mBAAZF,SAAyB,CACzC,GAAIC,GAAWE,QAAQ,YACnBD,EAAIC,QAAQ,aAChBC,QAAOJ,QAAUH,EAAQI,EAAUC,OAEnCL,GAAQD,EAAKK,SAAUL,EAAKM,KAG9BG,KAAM,SAASJ,EAAUC,GACzB,YAEA,IAAII,GAA6BL,EAASM,kBAgK1C,OAxJAN,GAASM,mBAAqB,SAAWN,EAAUC,GAKjD,GAAIM,GAAY,SAASC,GACvBJ,KAAKK,UACLL,KAAKM,iBACLN,KAAKO,kBACLP,KAAKQ,gBAELX,EAAEY,KAAKL,EAAOJ,KAAKU,IAAKV,MAM1BH,GAAEc,OAAOR,EAAUS,WAMjBF,IAAK,SAASG,EAAMC,GAClB,GAAIC,GAAUF,EAAKG,GAgBnB,OAbAhB,MAAKK,OAAOU,GAAWF,EAGnBA,EAAKI,QACPjB,KAAKM,cAAcO,EAAKI,MAAMD,KAAOD,GAInCD,IACFd,KAAKO,eAAeO,GAAeC,GAGrCf,KAAKQ,gBACER,MAKTkB,YAAa,SAASD,GACpB,MAAOjB,MAAKmB,eAAeF,EAAMD,MAMnCG,eAAgB,SAASC,GACvB,GAAIL,GAAUf,KAAKM,cAAcc,EACjC,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,WAEvC,MADA9C,GAASM,mBAAqBD,EACvBD,MAGFJ,EAASM"}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Backbone.BabySitter
|
||||
// -------------------
|
||||
// v0.1.2
|
||||
//
|
||||
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
||||
// Distributed under MIT license
|
||||
//
|
||||
// http://github.com/marionettejs/backbone.babysitter
|
||||
|
||||
(function(i,e){if("function"==typeof define&&define.amd)define(["exports","backbone","underscore"],function(i,t,n){return e(t,n)});else if("undefined"!=typeof exports){var t=require("backbone"),n=require("underscore");module.exports=e(t,n)}else e(i.Backbone,i._)})(this,function(i,e){"use strict";var t=i.ChildViewContainer;return i.ChildViewContainer=function(i,e){var t=function(i){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),e.each(i,this.add,this)};e.extend(t.prototype,{add:function(i,e){var t=i.cid;return this._views[t]=i,i.model&&(this._indexByModel[i.model.cid]=t),e&&(this._indexByCustom[e]=t),this._updateLength(),this},findByModel:function(i){return this.findByModelCid(i.cid)},findByModelCid:function(i){var e=this._indexByModel[i];return this.findByCid(e)},findByCustom:function(i){var e=this._indexByCustom[i];return this.findByCid(e)},findByIndex:function(i){return e.values(this._views)[i]},findByCid:function(i){return this._views[i]},remove:function(i){var t=i.cid;return i.model&&delete this._indexByModel[i.model.cid],e.any(this._indexByCustom,function(i,e){return i===t?(delete this._indexByCustom[e],!0):void 0},this),delete this._views[t],this._updateLength(),this},call:function(i){this.apply(i,e.tail(arguments))},apply:function(i,t){e.each(this._views,function(n){e.isFunction(n[i])&&n[i].apply(n,t||[])})},_updateLength:function(){this.length=e.size(this._views)}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return e.each(n,function(i){t.prototype[i]=function(){var t=e.values(this._views),n=[t].concat(e.toArray(arguments));return e[i].apply(e,n)}}),t}(i,e),i.ChildViewContainer.VERSION="0.1.2",i.ChildViewContainer.noConflict=function(){return i.ChildViewContainer=t,this},i.ChildViewContainer});
|
||||
//@ sourceMappingURL=backbone.babysitter.map
|
||||
@@ -0,0 +1,189 @@
|
||||
// Backbone.BabySitter
|
||||
// -------------------
|
||||
// v0.1.3
|
||||
//
|
||||
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
||||
// Distributed under MIT license
|
||||
//
|
||||
// http://github.com/marionettejs/backbone.babysitter
|
||||
|
||||
(function(root, factory) {
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['exports', 'backbone', 'underscore'], function(exports, Backbone, _) {
|
||||
return factory(Backbone, _);
|
||||
});
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
var Backbone = require('backbone');
|
||||
var _ = require('underscore');
|
||||
module.exports = factory(Backbone, _);
|
||||
} else {
|
||||
factory(root.Backbone, root._);
|
||||
}
|
||||
|
||||
}(this, function(Backbone, _) {
|
||||
"use strict";
|
||||
|
||||
var previousChildViewContainer = Backbone.ChildViewContainer;
|
||||
|
||||
// BabySitter.ChildViewContainer
|
||||
// -----------------------------
|
||||
//
|
||||
// Provide a container to store, retrieve and
|
||||
// shut down child views.
|
||||
|
||||
Backbone.ChildViewContainer = (function (Backbone, _) {
|
||||
|
||||
// Container Constructor
|
||||
// ---------------------
|
||||
|
||||
var Container = function(views){
|
||||
this._views = {};
|
||||
this._indexByModel = {};
|
||||
this._indexByCustom = {};
|
||||
this._updateLength();
|
||||
|
||||
_.each(views, this.add, this);
|
||||
};
|
||||
|
||||
// Container Methods
|
||||
// -----------------
|
||||
|
||||
_.extend(Container.prototype, {
|
||||
|
||||
// Add a view to this container. Stores the view
|
||||
// by `cid` and makes it searchable by the model
|
||||
// cid (and model itself). Optionally specify
|
||||
// a custom key to store an retrieve the view.
|
||||
add: function(view, customIndex){
|
||||
var viewCid = view.cid;
|
||||
|
||||
// store the view
|
||||
this._views[viewCid] = view;
|
||||
|
||||
// index it by model
|
||||
if (view.model){
|
||||
this._indexByModel[view.model.cid] = viewCid;
|
||||
}
|
||||
|
||||
// index by custom
|
||||
if (customIndex){
|
||||
this._indexByCustom[customIndex] = viewCid;
|
||||
}
|
||||
|
||||
this._updateLength();
|
||||
return this;
|
||||
},
|
||||
|
||||
// Find a view by the model that was attached to
|
||||
// it. Uses the model's `cid` to find it.
|
||||
findByModel: function(model){
|
||||
return this.findByModelCid(model.cid);
|
||||
},
|
||||
|
||||
// Find a view by the `cid` of the model that was attached to
|
||||
// it. Uses the model's `cid` to find the view `cid` and
|
||||
// retrieve the view using it.
|
||||
findByModelCid: function(modelCid){
|
||||
var viewCid = this._indexByModel[modelCid];
|
||||
return this.findByCid(viewCid);
|
||||
},
|
||||
|
||||
// Find a view by a custom indexer.
|
||||
findByCustom: function(index){
|
||||
var viewCid = this._indexByCustom[index];
|
||||
return this.findByCid(viewCid);
|
||||
},
|
||||
|
||||
// Find by index. This is not guaranteed to be a
|
||||
// stable index.
|
||||
findByIndex: function(index){
|
||||
return _.values(this._views)[index];
|
||||
},
|
||||
|
||||
// retrieve a view by its `cid` directly
|
||||
findByCid: function(cid){
|
||||
return this._views[cid];
|
||||
},
|
||||
|
||||
// Remove a view
|
||||
remove: function(view){
|
||||
var viewCid = view.cid;
|
||||
|
||||
// delete model index
|
||||
if (view.model){
|
||||
delete this._indexByModel[view.model.cid];
|
||||
}
|
||||
|
||||
// delete custom index
|
||||
_.any(this._indexByCustom, function(cid, key) {
|
||||
if (cid === viewCid) {
|
||||
delete this._indexByCustom[key];
|
||||
return true;
|
||||
}
|
||||
}, this);
|
||||
|
||||
// remove the view from the container
|
||||
delete this._views[viewCid];
|
||||
|
||||
// update the length
|
||||
this._updateLength();
|
||||
return this;
|
||||
},
|
||||
|
||||
// Call a method on every view in the container,
|
||||
// passing parameters to the call method one at a
|
||||
// time, like `function.call`.
|
||||
call: function(method){
|
||||
this.apply(method, _.tail(arguments));
|
||||
},
|
||||
|
||||
// Apply a method on every view in the container,
|
||||
// passing parameters to the call method one at a
|
||||
// time, like `function.apply`.
|
||||
apply: function(method, args){
|
||||
_.each(this._views, function(view){
|
||||
if (_.isFunction(view[method])){
|
||||
view[method].apply(view, args || []);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Update the `.length` attribute on this container
|
||||
_updateLength: function(){
|
||||
this.length = _.size(this._views);
|
||||
}
|
||||
});
|
||||
|
||||
// Borrowing this code from Backbone.Collection:
|
||||
// http://backbonejs.org/docs/backbone.html#section-106
|
||||
//
|
||||
// Mix in methods from Underscore, for iteration, and other
|
||||
// collection related features.
|
||||
var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
|
||||
'select', 'reject', 'every', 'all', 'some', 'any', 'include',
|
||||
'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
|
||||
'last', 'without', 'isEmpty', 'pluck'];
|
||||
|
||||
_.each(methods, function(method) {
|
||||
Container.prototype[method] = function() {
|
||||
var views = _.values(this._views);
|
||||
var args = [views].concat(_.toArray(arguments));
|
||||
return _[method].apply(_, args);
|
||||
};
|
||||
});
|
||||
|
||||
// return the public API
|
||||
return Container;
|
||||
})(Backbone, _);
|
||||
|
||||
Backbone.ChildViewContainer.VERSION = '0.1.3';
|
||||
|
||||
Backbone.ChildViewContainer.noConflict = function () {
|
||||
Backbone.ChildViewContainer = previousChildViewContainer;
|
||||
return this;
|
||||
};
|
||||
|
||||
return Backbone.ChildViewContainer;
|
||||
|
||||
}));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib/backbone.babysitter.min.js","sources":["?"],"names":["root","factory","define","amd","exports","Backbone","_","require","module","this","previousChildViewContainer","ChildViewContainer","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray","VERSION","noConflict"],"mappings":"CASC,SAASA,EAAMC,GAEd,GAAsB,kBAAXC,SAAyBA,OAAOC,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Z,KAAQD,SACHf,MAAKO,eAAeqB,IACpB,GAFT,QAIC5B,YAGIA,MAAKK,OAAOU,GAGnBf,KAAKQ,gBACER,MAMT6B,KAAM,SAASC,GACb9B,KAAK+B,MAAMD,EAAQjC,EAAEmC,KAAKC,aAM5BF,MAAO,SAASD,EAAQI,GACtBrC,EAAEY,KAAKT,KAAKK,OAAQ,SAASQ,GACvBhB,EAAEsC,WAAWtB,EAAKiB,KACpBjB,EAAKiB,GAAQC,MAAMlB,EAAMqB,UAM/B1B,cAAe,WACbR,KAAKoC,OAASvC,EAAEwC,KAAKrC,KAAKK,UAS9B,IAAIiC,IAAW,UAAW,OAAQ,MAAO,OAAQ,SAAU,SACzD,SAAU,SAAU,QAAS,MAAO,OAAQ,MAAO,UACnD,WAAY,SAAU,UAAW,QAAS,UAAW,OACrD,OAAQ,UAAW,UAAW,QAWhC,OATAzC,GAAEY,KAAK6B,EAAS,SAASR,GACvB3B,EAAUS,UAAUkB,GAAU,WAC5B,GAAI1B,GAAQP,EAAE4B,OAAOzB,KAAKK,QACtB6B,GAAQ9B,GAAOmC,OAAO1C,EAAE2C,QAAQP,WACpC,OAAOpC,GAAEiC,GAAQC,MAAMlC,EAAGqC,MAKvB/B,GACNP,EAAUC,GAEbD,EAASM,mBAAmBuC,QAAU,QAEtC7C,EAASM,mBAAmBwC,WAAa,WAEvC,MADA9C,GAASM,mBAAqBD,EACvBD,MAGFJ,EAASM"}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Backbone.BabySitter
|
||||
// -------------------
|
||||
// v0.1.3
|
||||
//
|
||||
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
||||
// Distributed under MIT license
|
||||
//
|
||||
// http://github.com/marionettejs/backbone.babysitter
|
||||
|
||||
(function(i,e){if("function"==typeof define&&define.amd)define(["exports","backbone","underscore"],function(i,t,n){return e(t,n)});else if("undefined"!=typeof exports){var t=require("backbone"),n=require("underscore");module.exports=e(t,n)}else e(i.Backbone,i._)})(this,function(i,e){"use strict";var t=i.ChildViewContainer;return i.ChildViewContainer=function(i,e){var t=function(i){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),e.each(i,this.add,this)};e.extend(t.prototype,{add:function(i,e){var t=i.cid;return this._views[t]=i,i.model&&(this._indexByModel[i.model.cid]=t),e&&(this._indexByCustom[e]=t),this._updateLength(),this},findByModel:function(i){return this.findByModelCid(i.cid)},findByModelCid:function(i){var e=this._indexByModel[i];return this.findByCid(e)},findByCustom:function(i){var e=this._indexByCustom[i];return this.findByCid(e)},findByIndex:function(i){return e.values(this._views)[i]},findByCid:function(i){return this._views[i]},remove:function(i){var t=i.cid;return i.model&&delete this._indexByModel[i.model.cid],e.any(this._indexByCustom,function(i,e){return i===t?(delete this._indexByCustom[e],!0):void 0},this),delete this._views[t],this._updateLength(),this},call:function(i){this.apply(i,e.tail(arguments))},apply:function(i,t){e.each(this._views,function(n){e.isFunction(n[i])&&n[i].apply(n,t||[])})},_updateLength:function(){this.length=e.size(this._views)}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return e.each(n,function(i){t.prototype[i]=function(){var t=e.values(this._views),n=[t].concat(e.toArray(arguments));return e[i].apply(e,n)}}),t}(i,e),i.ChildViewContainer.VERSION="0.1.3",i.ChildViewContainer.noConflict=function(){return i.ChildViewContainer=t,this},i.ChildViewContainer});
|
||||
//@ sourceMappingURL=backbone.babysitter.map
|
||||
@@ -0,0 +1,190 @@
|
||||
// Backbone.BabySitter
|
||||
// -------------------
|
||||
// v0.1.4
|
||||
//
|
||||
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
||||
// Distributed under MIT license
|
||||
//
|
||||
// http://github.com/marionettejs/backbone.babysitter
|
||||
|
||||
(function(root, factory) {
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['backbone', 'underscore'], function(Backbone, _) {
|
||||
return factory(Backbone, _);
|
||||
});
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
var Backbone = require('backbone');
|
||||
var _ = require('underscore');
|
||||
module.exports = factory(Backbone, _);
|
||||
} else {
|
||||
factory(root.Backbone, root._);
|
||||
}
|
||||
|
||||
}(this, function(Backbone, _) {
|
||||
'use strict';
|
||||
|
||||
var previousChildViewContainer = Backbone.ChildViewContainer;
|
||||
|
||||
// BabySitter.ChildViewContainer
|
||||
// -----------------------------
|
||||
//
|
||||
// Provide a container to store, retrieve and
|
||||
// shut down child views.
|
||||
|
||||
Backbone.ChildViewContainer = (function (Backbone, _) {
|
||||
|
||||
// Container Constructor
|
||||
// ---------------------
|
||||
|
||||
var Container = function(views){
|
||||
this._views = {};
|
||||
this._indexByModel = {};
|
||||
this._indexByCustom = {};
|
||||
this._updateLength();
|
||||
|
||||
_.each(views, this.add, this);
|
||||
};
|
||||
|
||||
// Container Methods
|
||||
// -----------------
|
||||
|
||||
_.extend(Container.prototype, {
|
||||
|
||||
// Add a view to this container. Stores the view
|
||||
// by `cid` and makes it searchable by the model
|
||||
// cid (and model itself). Optionally specify
|
||||
// a custom key to store an retrieve the view.
|
||||
add: function(view, customIndex){
|
||||
var viewCid = view.cid;
|
||||
|
||||
// store the view
|
||||
this._views[viewCid] = view;
|
||||
|
||||
// index it by model
|
||||
if (view.model){
|
||||
this._indexByModel[view.model.cid] = viewCid;
|
||||
}
|
||||
|
||||
// index by custom
|
||||
if (customIndex){
|
||||
this._indexByCustom[customIndex] = viewCid;
|
||||
}
|
||||
|
||||
this._updateLength();
|
||||
return this;
|
||||
},
|
||||
|
||||
// Find a view by the model that was attached to
|
||||
// it. Uses the model's `cid` to find it.
|
||||
findByModel: function(model){
|
||||
return this.findByModelCid(model.cid);
|
||||
},
|
||||
|
||||
// Find a view by the `cid` of the model that was attached to
|
||||
// it. Uses the model's `cid` to find the view `cid` and
|
||||
// retrieve the view using it.
|
||||
findByModelCid: function(modelCid){
|
||||
var viewCid = this._indexByModel[modelCid];
|
||||
return this.findByCid(viewCid);
|
||||
},
|
||||
|
||||
// Find a view by a custom indexer.
|
||||
findByCustom: function(index){
|
||||
var viewCid = this._indexByCustom[index];
|
||||
return this.findByCid(viewCid);
|
||||
},
|
||||
|
||||
// Find by index. This is not guaranteed to be a
|
||||
// stable index.
|
||||
findByIndex: function(index){
|
||||
return _.values(this._views)[index];
|
||||
},
|
||||
|
||||
// retrieve a view by its `cid` directly
|
||||
findByCid: function(cid){
|
||||
return this._views[cid];
|
||||
},
|
||||
|
||||
// Remove a view
|
||||
remove: function(view){
|
||||
var viewCid = view.cid;
|
||||
|
||||
// delete model index
|
||||
if (view.model){
|
||||
delete this._indexByModel[view.model.cid];
|
||||
}
|
||||
|
||||
// delete custom index
|
||||
_.any(this._indexByCustom, function(cid, key) {
|
||||
if (cid === viewCid) {
|
||||
delete this._indexByCustom[key];
|
||||
return true;
|
||||
}
|
||||
}, this);
|
||||
|
||||
// remove the view from the container
|
||||
delete this._views[viewCid];
|
||||
|
||||
// update the length
|
||||
this._updateLength();
|
||||
return this;
|
||||
},
|
||||
|
||||
// Call a method on every view in the container,
|
||||
// passing parameters to the call method one at a
|
||||
// time, like `function.call`.
|
||||
call: function(method){
|
||||
this.apply(method, _.tail(arguments));
|
||||
},
|
||||
|
||||
// Apply a method on every view in the container,
|
||||
// passing parameters to the call method one at a
|
||||
// time, like `function.apply`.
|
||||
apply: function(method, args){
|
||||
_.each(this._views, function(view){
|
||||
if (_.isFunction(view[method])){
|
||||
view[method].apply(view, args || []);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Update the `.length` attribute on this container
|
||||
_updateLength: function(){
|
||||
this.length = _.size(this._views);
|
||||
}
|
||||
});
|
||||
|
||||
// Borrowing this code from Backbone.Collection:
|
||||
// http://backbonejs.org/docs/backbone.html#section-106
|
||||
//
|
||||
// Mix in methods from Underscore, for iteration, and other
|
||||
// collection related features.
|
||||
var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
|
||||
'select', 'reject', 'every', 'all', 'some', 'any', 'include',
|
||||
'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
|
||||
'last', 'without', 'isEmpty', 'pluck'];
|
||||
|
||||
_.each(methods, function(method) {
|
||||
Container.prototype[method] = function() {
|
||||
var views = _.values(this._views);
|
||||
var args = [views].concat(_.toArray(arguments));
|
||||
return _[method].apply(_, args);
|
||||
};
|
||||
});
|
||||
|
||||
// return the public API
|
||||
return Container;
|
||||
})(Backbone, _);
|
||||
|
||||
|
||||
Backbone.ChildViewContainer.VERSION = '0.1.4';
|
||||
|
||||
Backbone.ChildViewContainer.noConflict = function () {
|
||||
Backbone.ChildViewContainer = previousChildViewContainer;
|
||||
return this;
|
||||
};
|
||||
|
||||
return Backbone.ChildViewContainer;
|
||||
|
||||
}));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib/backbone.babysitter.min.js","sources":["?"],"names":["root","factory","define","amd","Backbone","_","exports","require","module","this","previousChildViewContainer","ChildViewContainer","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray","VERSION","noConflict"],"mappings":"CASC,SAASA,EAAMC,GAEd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,WAAY,cAAe,SAASE,EAAUC,GACpD,MAAOJ,GAAQG,EAAUC,SAEtB,IAAuB,mBAAZC,SAAyB,CACzC,GAAIF,GAAWG,QAAQ,YACnBF,EAAIE,QAAQ,aAChBC,QAAOF,QAAUL,EAAQG,EAAUC,OAEnCJ,GAAQD,EAAKI,SAAUJ,EAAKK,KAG9BI,KAAM,SAASL,EAAUC,GACzB,YAEA,IAAIK,GAA6BN,EAASO,kBAiK1C,OAzJAP,GAASO,mBAAqB,SAAWP,EAAUC,GAKjD,GAAIO,GAAY,SAASC,GACvBJ,KAAKK,UACLL,KAAKM,iBACLN,KAAKO,k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AO,OAAQ,SAAU,SACzD,SAAU,SAAU,QAAS,MAAO,OAAQ,MAAO,UACnD,WAAY,SAAU,UAAW,QAAS,UAAW,OACrD,OAAQ,UAAW,UAAW,QAWhC,OATA1C,GAAEa,KAAK6B,EAAS,SAASR,GACvB3B,EAAUS,UAAUkB,GAAU,WAC5B,GAAI1B,GAAQR,EAAE6B,OAAOzB,KAAKK,QACtB6B,GAAQ9B,GAAOmC,OAAO3C,EAAE4C,QAAQP,WACpC,OAAOrC,GAAEkC,GAAQC,MAAMnC,EAAGsC,MAKvB/B,GACNR,EAAUC,GAGbD,EAASO,mBAAmBuC,QAAU,QAEtC9C,EAASO,mBAAmBwC,WAAa,WAEvC,MADA/C,GAASO,mBAAqBD,EACvBD,MAGFL,EAASO"}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Backbone.BabySitter
|
||||
// -------------------
|
||||
// v0.1.4
|
||||
//
|
||||
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
||||
// Distributed under MIT license
|
||||
//
|
||||
// http://github.com/marionettejs/backbone.babysitter
|
||||
|
||||
(function(i,e){if("function"==typeof define&&define.amd)define(["backbone","underscore"],function(i,t){return e(i,t)});else if("undefined"!=typeof exports){var t=require("backbone"),n=require("underscore");module.exports=e(t,n)}else e(i.Backbone,i._)})(this,function(i,e){"use strict";var t=i.ChildViewContainer;return i.ChildViewContainer=function(i,e){var t=function(i){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),e.each(i,this.add,this)};e.extend(t.prototype,{add:function(i,e){var t=i.cid;return this._views[t]=i,i.model&&(this._indexByModel[i.model.cid]=t),e&&(this._indexByCustom[e]=t),this._updateLength(),this},findByModel:function(i){return this.findByModelCid(i.cid)},findByModelCid:function(i){var e=this._indexByModel[i];return this.findByCid(e)},findByCustom:function(i){var e=this._indexByCustom[i];return this.findByCid(e)},findByIndex:function(i){return e.values(this._views)[i]},findByCid:function(i){return this._views[i]},remove:function(i){var t=i.cid;return i.model&&delete this._indexByModel[i.model.cid],e.any(this._indexByCustom,function(i,e){return i===t?(delete this._indexByCustom[e],!0):void 0},this),delete this._views[t],this._updateLength(),this},call:function(i){this.apply(i,e.tail(arguments))},apply:function(i,t){e.each(this._views,function(n){e.isFunction(n[i])&&n[i].apply(n,t||[])})},_updateLength:function(){this.length=e.size(this._views)}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return e.each(n,function(i){t.prototype[i]=function(){var t=e.values(this._views),n=[t].concat(e.toArray(arguments));return e[i].apply(e,n)}}),t}(i,e),i.ChildViewContainer.VERSION="0.1.4",i.ChildViewContainer.noConflict=function(){return i.ChildViewContainer=t,this},i.ChildViewContainer});
|
||||
//@ sourceMappingURL=backbone.babysitter.map
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "backbone.babysitter",
|
||||
"description": "Manage child views in a Backbone.View",
|
||||
"version": "0.1.4",
|
||||
"homepage": "https://github.com/marionettejs/backbone.babysitter",
|
||||
"main": "lib/backbone.babysitter.js",
|
||||
"filename": "backbone.babysitter.min.js",
|
||||
"keywords": [
|
||||
"backbone",
|
||||
"plugin",
|
||||
"computed",
|
||||
"field",
|
||||
"model",
|
||||
"client",
|
||||
"browser"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/marionettejs/backbone.babysitter/blob/master/LICENSE.md"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "grunt jasmine",
|
||||
"start": "grunt jasmine-server"
|
||||
},
|
||||
"author": {
|
||||
"name": "Derick Bailey",
|
||||
"email": "marionettejs@gmail.com",
|
||||
"web": "http://derickbailey.lostechies.com"
|
||||
},
|
||||
"bugs": {
|
||||
"web": "https://github.com/marionettejs/backbone.babysitter/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/marionettejs/backbone.babysitter.git"
|
||||
},
|
||||
"github": "https://github.com/marionettejs/backbone.babysitter",
|
||||
"dependencies": {
|
||||
"backbone": ">=0.9.9 <=1.1.2",
|
||||
"underscore": ">=1.4.0 <=1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.4",
|
||||
"grunt-contrib-jasmine": "~0.6.4",
|
||||
"grunt-contrib-jshint": "~0.1.1",
|
||||
"grunt-preprocess": "~4.0.0",
|
||||
"grunt-contrib-uglify": "~0.1.1",
|
||||
"grunt-contrib-concat": "~0.1.2",
|
||||
"grunt-contrib-watch": "~0.2.0",
|
||||
"grunt-contrib-connect": "~0.1.2",
|
||||
"grunt-template": "^0.2.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user