marionette.toolkit
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "marionette.toolkit", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A collection of opinionated Backbone.Marionette extensions for large scale application architecture.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/marionette.toolkit.js", |
@@ -0,1 +1,6 @@ | ||
#### v0.4.1 | ||
* Updated underscore and backbone dependencies. | ||
* Small refactor to defaulting empty passed in `options` as an object. | ||
#### v0.4.0 | ||
@@ -2,0 +7,0 @@ |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.4.0 | ||
* @version v0.4.1 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
@@ -29,3 +29,3 @@ * @license MIT | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -181,3 +181,3 @@ // Make defaults available to this | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -429,3 +429,3 @@ _.bindAll(this, "start", "stop"); | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -719,3 +719,3 @@ this._childApps = {}; | ||
removeChildApp: function removeChildApp(appName, options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -779,3 +779,3 @@ var childApp = this.getChildApp(appName); | ||
constructor: function constructor(stateAttrs, options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -885,3 +885,3 @@ // Make defaults available to this | ||
_getViewClass: function _getViewClass(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -1055,3 +1055,3 @@ var ViewClass = this.getOption("ViewClass"); | ||
Toolkit.VERSION = "0.4.0"; | ||
Toolkit.VERSION = "0.4.1"; | ||
@@ -1058,0 +1058,0 @@ Toolkit.StateClass = state_class; |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.4.0 | ||
* @version v0.4.1 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
* @license MIT | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("backbone.marionette"),require("underscore"),require("backbone")):"function"==typeof define&&define.amd?define(["backbone.marionette","underscore","backbone"],e):t.Marionette.Toolkit=e(t.Marionette,t._,t.Backbone)}(this,function(t,e,i){"use strict";var s=t.Object.extend({StateModel:i.Model,constructor:function(i){i=i||{},e.extend(this,e.pick(i,["StateModel","stateEvents","stateDefaults"]));var s=this._getStateModel(i);this._stateModel=new s(e.result(this,"stateDefaults")),this.bindEntityEvents(this._stateModel,e.result(this,"stateEvents")),t.Object.call(this,i)},_getStateModel:function(s){var n=this.getOption("StateModel");if(n.prototype instanceof i.Model||n===i.Model)return n;if(e.isFunction(n))return n.call(this,s);throw new t.Error({name:"InvalidStateModelError",message:'"StateModel" must be a model class or a function that returns a model class'})},setState:function(){return this._stateModel.set.apply(this._stateModel,arguments)},getState:function(t){return t?this._stateModel.get.apply(this._stateModel,arguments):this._stateModel},destroy:function(){this._stateModel.stopListening(),t.Object.prototype.destroy.apply(this,arguments)}}),n=s,r=n.extend({_isRunning:!1,_isDestroyed:!1,preventDestroy:!1,startAfterInitialized:!1,startWithParent:!1,stopWithParent:!0,constructor:function(t){t=t||{},e.bindAll(this,"start","stop");var i=["startWithParent","stopWithParent","startAfterInitialized","preventDestroy"];e.extend(this,e.pick(t,i)),n.call(this,t),e.result(this,"startAfterInitialized")&&this.start(t)},_ensureAppIsIntact:function(){if(this._isDestroyed)throw new t.Error({name:"AppDestroyedError",message:"App has already been destroyed and cannot be used."})},isRunning:function(){return this._isRunning},start:function(t){return this._ensureAppIsIntact(),this._isRunning?this:(this.triggerMethod("before:start",t),this._isRunning=!0,this.triggerStart(t),this)},triggerStart:function(t){this.triggerMethod("start",t)},stop:function(t){return this._isRunning?(this.triggerMethod("before:stop",t),this._isRunning=!1,this.triggerMethod("stop",t),this._stopRunningListeners(),this._stopRunningEvents(),this):this},isDestroyed:function(){return this._isDestroyed},destroy:function(){this._isDestroyed||(this._isDestroyed=!0,this.stop(),n.prototype.destroy.apply(this,arguments))},_stopRunningEvents:function(){e.each(this._runningEvents,function(t){this.off.apply(this,t)},this)},_stopRunningListeners:function(){e.each(this._runningListeningTo,function(t){this.stopListening.apply(this,t)},this)},on:function(){return this._isRunning&&(this._runningEvents=this._runningEvents||[],this._runningEvents.push(arguments)),n.prototype.on.apply(this,arguments)},listenTo:function(){return this._isRunning&&(this._runningListeningTo=this._runningListeningTo||[],this._runningListeningTo.push(arguments)),n.prototype.listenTo.apply(this,arguments)},listenToOnce:function(){return this._isRunning&&(this._runningListeningTo=this._runningListeningTo||[],this._runningListeningTo.push(arguments)),n.prototype.listenToOnce.apply(this,arguments)}}),o=r,h=o.extend({constructor:function(t){t=t||{},this._childApps={},e.extend(this,e.pick(t,["childApps"])),this._initChildApps(t),this.on({start:this._startChildApps,"before:stop":this._stopChildApps,"before:destroy":this._destroyChildApps}),o.call(this,t)},_initChildApps:function(t){var i=this.childApps;i&&(e.isFunction(i)&&(i=i.call(this,t)),this.addChildApps(i))},_startChildApps:function(){e.each(this._childApps,function(t){e.result(t,"startWithParent")&&t.start()})},_stopChildApps:function(){e.each(this._childApps,function(t){e.result(t,"stopWithParent")&&t.stop()})},_destroyChildApps:function(){e.each(this._childApps,function(t){e.result(t,"preventDestroy")||t.destroy()})},_buildAppFromObject:function(t){var i=t.AppClass,s=e.omit(t,"AppClass");return this.buildApp(i,s)},_buildApp:function(t,i){return e.isFunction(t)?this.buildApp(t,i):e.isObject(t)?this._buildAppFromObject(t):void 0},buildApp:function(t,e){return new t(e)},_ensureAppIsUnique:function(e){if(this._childApps[e])throw new t.Error({name:"DuplicateChildAppError",message:'A child App with name "'+e+'" has already been added.'})},addChildApps:function(t){e.each(t,function(t,e){this.addChildApp(e,t)},this)},addChildApp:function(i,s,n){this._ensureAppIsUnique(i);var r=this._buildApp(s,n);if(!r)throw new t.Error({name:"AddChildAppError",message:"App build failed. Incorrect configuration."});return r._name=i,this._childApps[i]=r,r.on("destroy",e.partial(this._removeChildApp,i),this),this.isRunning()&&e.result(r,"startWithParent")&&r.start(),r},getName:function(){return this._name},getChildApps:function(){return e.clone(this._childApps)},getChildApp:function(t){return this._childApps[t]},_removeChildApp:function(t){delete this._childApps[t]._name,delete this._childApps[t]},removeChildApps:function(){var t=this.getChildApps();return e.each(this._childApps,function(t,e){this.removeChildApp(e)},this),t},removeChildApp:function(t,i){i=i||{};var s=this.getChildApp(t);if(s)return i.preventDestroy||e.result(s,"preventDestroy")?this._removeChildApp(t):s.destroy(),s}}),a=h,p=n.extend({ViewClass:t.ItemView,viewEventPrefix:"view",viewOptions:{},constructor:function(t,i){i=i||{},e.extend(this,e.pick(i,["viewEventPrefix","ViewClass","viewOptions","region"])),n.call(this,i),this._setStateDefaults(t)},_shouldDestroy:!0,_setStateDefaults:function(t){this.setState(t,{silent:!0})},showIn:function(t,e){return this.region=t,this.show(e),this},show:function(e){if(this._isShown)throw new t.Error({name:"ComponentShowError",message:"Component has already been shown in a region."});if(!this.region)throw new t.Error({name:"ComponentRegionError",message:"Component has no defined region."});return this.triggerMethod("before:show"),this.renderView(e),this._isShown=!0,this.triggerMethod("show"),this.listenTo(this.region,"empty",this._destroy),this},_getViewClass:function(s){s=s||{};var n=this.getOption("ViewClass");if(n.prototype instanceof i.View||n===i.View)return n;if(e.isFunction(n))return n.call(this,s);throw new t.Error({name:"InvalidViewClassError",message:'"ViewClass" must be a view class or a function that returns a view class'})},renderView:function(t){var e=this._getViewClass(t),i=this.mixinOptions(t),s=this.buildView(e,i);return this.currentView=s,this._proxyViewEvents(s),this.triggerMethod("before:render:view",s),this._shouldDestroy=!1,this.region.show(s),this._shouldDestroy=!0,this.triggerMethod("render:view",s),this},_proxyViewEvents:function(t){var i=this.getOption("viewEventPrefix");t.on("all",function(){var s=e.toArray(arguments),n=s[0];s[0]=i+":"+n,s.splice(1,0,t),this.triggerMethod.apply(this,s)},this)},mixinOptions:function(t){var i=e.result(this,"viewOptions");return e.extend({stateModel:this.getState()},i,t)},buildView:function(t,e){return new t(e)},_destroy:function(){this._shouldDestroy&&n.prototype.destroy.apply(this,arguments)},_emptyRegion:function(t){this.region&&(this.stopListening(this.region,"empty"),this.region.empty(t))},destroy:function(t){this._emptyRegion(t),this._shouldDestroy=!0,this._destroy(t)}}),u=p,l=t.Toolkit,d=t.Toolkit={};d.noConflict=function(){return t.Toolkit=l,this},d.VERSION="0.4.0",d.StateClass=n,d.App=a,d.Component=u;var c=d;return c}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("backbone.marionette"),require("underscore"),require("backbone")):"function"==typeof define&&define.amd?define(["backbone.marionette","underscore","backbone"],e):t.Marionette.Toolkit=e(t.Marionette,t._,t.Backbone)}(this,function(t,e,i){"use strict";var s=t.Object.extend({StateModel:i.Model,constructor:function(i){i=e.extend({},i),e.extend(this,e.pick(i,["StateModel","stateEvents","stateDefaults"]));var s=this._getStateModel(i);this._stateModel=new s(e.result(this,"stateDefaults")),this.bindEntityEvents(this._stateModel,e.result(this,"stateEvents")),t.Object.call(this,i)},_getStateModel:function(s){var n=this.getOption("StateModel");if(n.prototype instanceof i.Model||n===i.Model)return n;if(e.isFunction(n))return n.call(this,s);throw new t.Error({name:"InvalidStateModelError",message:'"StateModel" must be a model class or a function that returns a model class'})},setState:function(){return this._stateModel.set.apply(this._stateModel,arguments)},getState:function(t){return t?this._stateModel.get.apply(this._stateModel,arguments):this._stateModel},destroy:function(){this._stateModel.stopListening(),t.Object.prototype.destroy.apply(this,arguments)}}),n=s,r=n.extend({_isRunning:!1,_isDestroyed:!1,preventDestroy:!1,startAfterInitialized:!1,startWithParent:!1,stopWithParent:!0,constructor:function(t){t=e.extend({},t),e.bindAll(this,"start","stop");var i=["startWithParent","stopWithParent","startAfterInitialized","preventDestroy"];e.extend(this,e.pick(t,i)),n.call(this,t),e.result(this,"startAfterInitialized")&&this.start(t)},_ensureAppIsIntact:function(){if(this._isDestroyed)throw new t.Error({name:"AppDestroyedError",message:"App has already been destroyed and cannot be used."})},isRunning:function(){return this._isRunning},start:function(t){return this._ensureAppIsIntact(),this._isRunning?this:(this.triggerMethod("before:start",t),this._isRunning=!0,this.triggerStart(t),this)},triggerStart:function(t){this.triggerMethod("start",t)},stop:function(t){return this._isRunning?(this.triggerMethod("before:stop",t),this._isRunning=!1,this.triggerMethod("stop",t),this._stopRunningListeners(),this._stopRunningEvents(),this):this},isDestroyed:function(){return this._isDestroyed},destroy:function(){this._isDestroyed||(this._isDestroyed=!0,this.stop(),n.prototype.destroy.apply(this,arguments))},_stopRunningEvents:function(){e.each(this._runningEvents,function(t){this.off.apply(this,t)},this)},_stopRunningListeners:function(){e.each(this._runningListeningTo,function(t){this.stopListening.apply(this,t)},this)},on:function(){return this._isRunning&&(this._runningEvents=this._runningEvents||[],this._runningEvents.push(arguments)),n.prototype.on.apply(this,arguments)},listenTo:function(){return this._isRunning&&(this._runningListeningTo=this._runningListeningTo||[],this._runningListeningTo.push(arguments)),n.prototype.listenTo.apply(this,arguments)},listenToOnce:function(){return this._isRunning&&(this._runningListeningTo=this._runningListeningTo||[],this._runningListeningTo.push(arguments)),n.prototype.listenToOnce.apply(this,arguments)}}),o=r,h=o.extend({constructor:function(t){t=e.extend({},t),this._childApps={},e.extend(this,e.pick(t,["childApps"])),this._initChildApps(t),this.on({start:this._startChildApps,"before:stop":this._stopChildApps,"before:destroy":this._destroyChildApps}),o.call(this,t)},_initChildApps:function(t){var i=this.childApps;i&&(e.isFunction(i)&&(i=i.call(this,t)),this.addChildApps(i))},_startChildApps:function(){e.each(this._childApps,function(t){e.result(t,"startWithParent")&&t.start()})},_stopChildApps:function(){e.each(this._childApps,function(t){e.result(t,"stopWithParent")&&t.stop()})},_destroyChildApps:function(){e.each(this._childApps,function(t){e.result(t,"preventDestroy")||t.destroy()})},_buildAppFromObject:function(t){var i=t.AppClass,s=e.omit(t,"AppClass");return this.buildApp(i,s)},_buildApp:function(t,i){return e.isFunction(t)?this.buildApp(t,i):e.isObject(t)?this._buildAppFromObject(t):void 0},buildApp:function(t,e){return new t(e)},_ensureAppIsUnique:function(e){if(this._childApps[e])throw new t.Error({name:"DuplicateChildAppError",message:'A child App with name "'+e+'" has already been added.'})},addChildApps:function(t){e.each(t,function(t,e){this.addChildApp(e,t)},this)},addChildApp:function(i,s,n){this._ensureAppIsUnique(i);var r=this._buildApp(s,n);if(!r)throw new t.Error({name:"AddChildAppError",message:"App build failed. Incorrect configuration."});return r._name=i,this._childApps[i]=r,r.on("destroy",e.partial(this._removeChildApp,i),this),this.isRunning()&&e.result(r,"startWithParent")&&r.start(),r},getName:function(){return this._name},getChildApps:function(){return e.clone(this._childApps)},getChildApp:function(t){return this._childApps[t]},_removeChildApp:function(t){delete this._childApps[t]._name,delete this._childApps[t]},removeChildApps:function(){var t=this.getChildApps();return e.each(this._childApps,function(t,e){this.removeChildApp(e)},this),t},removeChildApp:function(t,i){i=e.extend({},i);var s=this.getChildApp(t);if(s)return i.preventDestroy||e.result(s,"preventDestroy")?this._removeChildApp(t):s.destroy(),s}}),a=h,p=n.extend({ViewClass:t.ItemView,viewEventPrefix:"view",viewOptions:{},constructor:function(t,i){i=e.extend({},i),e.extend(this,e.pick(i,["viewEventPrefix","ViewClass","viewOptions","region"])),n.call(this,i),this._setStateDefaults(t)},_shouldDestroy:!0,_setStateDefaults:function(t){this.setState(t,{silent:!0})},showIn:function(t,e){return this.region=t,this.show(e),this},show:function(e){if(this._isShown)throw new t.Error({name:"ComponentShowError",message:"Component has already been shown in a region."});if(!this.region)throw new t.Error({name:"ComponentRegionError",message:"Component has no defined region."});return this.triggerMethod("before:show"),this.renderView(e),this._isShown=!0,this.triggerMethod("show"),this.listenTo(this.region,"empty",this._destroy),this},_getViewClass:function(s){s=e.extend({},s);var n=this.getOption("ViewClass");if(n.prototype instanceof i.View||n===i.View)return n;if(e.isFunction(n))return n.call(this,s);throw new t.Error({name:"InvalidViewClassError",message:'"ViewClass" must be a view class or a function that returns a view class'})},renderView:function(t){var e=this._getViewClass(t),i=this.mixinOptions(t),s=this.buildView(e,i);return this.currentView=s,this._proxyViewEvents(s),this.triggerMethod("before:render:view",s),this._shouldDestroy=!1,this.region.show(s),this._shouldDestroy=!0,this.triggerMethod("render:view",s),this},_proxyViewEvents:function(t){var i=this.getOption("viewEventPrefix");t.on("all",function(){var s=e.toArray(arguments),n=s[0];s[0]=i+":"+n,s.splice(1,0,t),this.triggerMethod.apply(this,s)},this)},mixinOptions:function(t){var i=e.result(this,"viewOptions");return e.extend({stateModel:this.getState()},i,t)},buildView:function(t,e){return new t(e)},_destroy:function(){this._shouldDestroy&&n.prototype.destroy.apply(this,arguments)},_emptyRegion:function(t){this.region&&(this.stopListening(this.region,"empty"),this.region.empty(t))},destroy:function(t){this._emptyRegion(t),this._shouldDestroy=!0,this._destroy(t)}}),u=p,l=t.Toolkit,d=t.Toolkit={};d.noConflict=function(){return t.Toolkit=l,this},d.VERSION="0.4.1",d.StateClass=n,d.App=a,d.Component=u;var c=d;return c}); | ||
//# sourceMappingURL=marionette.toolkit.min.js.map |
@@ -147,4 +147,5 @@ var gulp = require('gulp'); | ||
gulp.src('./packages/package.json') | ||
gulp.src('./packages/package.json.template') | ||
.pipe($.template(data)) | ||
.pipe($.rename('package.json')) | ||
.pipe(gulp.dest(destFolder)); | ||
@@ -151,0 +152,0 @@ } |
{ | ||
"name": "marionette.toolkit", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A collection of opinionated Backbone.Marionette extensions for large scale application architecture.", | ||
@@ -10,3 +10,4 @@ "main": "./dist/marionette.toolkit.js", | ||
"build": "gulp build", | ||
"coverage": "gulp coverage" | ||
"coverage": "gulp coverage", | ||
"deploy": "./ship.sh" | ||
}, | ||
@@ -92,5 +93,5 @@ "repository": { | ||
"backbone.marionette": "^2.1.0", | ||
"backbone": "1.0.0 - 1.1.2", | ||
"underscore": "1.4.4 - 1.8.3" | ||
"backbone": "^1.0.0", | ||
"underscore": "^1.4.4" | ||
} | ||
} |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.4.0 | ||
* @version v0.4.1 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
@@ -75,3 +75,3 @@ * @license MIT | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -323,3 +323,3 @@ _.bindAll(this, "start", "stop"); | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -613,3 +613,3 @@ this._childApps = {}; | ||
removeChildApp: function removeChildApp(appName, options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -616,0 +616,0 @@ var childApp = this.getChildApp(appName); |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.4.0 | ||
* @version v0.4.1 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
* @license MIT | ||
*/ | ||
"use strict";var _=require("underscore"),Marionette=require("backbone.marionette"),StateClass=require("marionette.toolkit.state-class"),AbstractApp=StateClass.extend({_isRunning:!1,_isDestroyed:!1,preventDestroy:!1,startAfterInitialized:!1,startWithParent:!1,stopWithParent:!0,constructor:function(t){t=t||{},_.bindAll(this,"start","stop");var e=["startWithParent","stopWithParent","startAfterInitialized","preventDestroy"];_.extend(this,_.pick(t,e)),StateClass.call(this,t),_.result(this,"startAfterInitialized")&&this.start(t)},_ensureAppIsIntact:function(){if(this._isDestroyed)throw new Marionette.Error({name:"AppDestroyedError",message:"App has already been destroyed and cannot be used."})},isRunning:function(){return this._isRunning},start:function(t){return this._ensureAppIsIntact(),this._isRunning?this:(this.triggerMethod("before:start",t),this._isRunning=!0,this.triggerStart(t),this)},triggerStart:function(t){this.triggerMethod("start",t)},stop:function(t){return this._isRunning?(this.triggerMethod("before:stop",t),this._isRunning=!1,this.triggerMethod("stop",t),this._stopRunningListeners(),this._stopRunningEvents(),this):this},isDestroyed:function(){return this._isDestroyed},destroy:function(){this._isDestroyed||(this._isDestroyed=!0,this.stop(),StateClass.prototype.destroy.apply(this,arguments))},_stopRunningEvents:function(){_.each(this._runningEvents,function(t){this.off.apply(this,t)},this)},_stopRunningListeners:function(){_.each(this._runningListeningTo,function(t){this.stopListening.apply(this,t)},this)},on:function(){return this._isRunning&&(this._runningEvents=this._runningEvents||[],this._runningEvents.push(arguments)),StateClass.prototype.on.apply(this,arguments)},listenTo:function(){return this._isRunning&&(this._runningListeningTo=this._runningListeningTo||[],this._runningListeningTo.push(arguments)),StateClass.prototype.listenTo.apply(this,arguments)},listenToOnce:function(){return this._isRunning&&(this._runningListeningTo=this._runningListeningTo||[],this._runningListeningTo.push(arguments)),StateClass.prototype.listenToOnce.apply(this,arguments)}}),abstract_app=AbstractApp,App=abstract_app.extend({constructor:function(t){t=t||{},this._childApps={},_.extend(this,_.pick(t,["childApps"])),this._initChildApps(t),this.on({start:this._startChildApps,"before:stop":this._stopChildApps,"before:destroy":this._destroyChildApps}),abstract_app.call(this,t)},_initChildApps:function(t){var e=this.childApps;e&&(_.isFunction(e)&&(e=e.call(this,t)),this.addChildApps(e))},_startChildApps:function(){_.each(this._childApps,function(t){_.result(t,"startWithParent")&&t.start()})},_stopChildApps:function(){_.each(this._childApps,function(t){_.result(t,"stopWithParent")&&t.stop()})},_destroyChildApps:function(){_.each(this._childApps,function(t){_.result(t,"preventDestroy")||t.destroy()})},_buildAppFromObject:function(t){var e=t.AppClass,i=_.omit(t,"AppClass");return this.buildApp(e,i)},_buildApp:function(t,e){return _.isFunction(t)?this.buildApp(t,e):_.isObject(t)?this._buildAppFromObject(t):void 0},buildApp:function(t,e){return new t(e)},_ensureAppIsUnique:function(t){if(this._childApps[t])throw new Marionette.Error({name:"DuplicateChildAppError",message:'A child App with name "'+t+'" has already been added.'})},addChildApps:function(t){_.each(t,function(t,e){this.addChildApp(e,t)},this)},addChildApp:function(t,e,i){this._ensureAppIsUnique(t);var s=this._buildApp(e,i);if(!s)throw new Marionette.Error({name:"AddChildAppError",message:"App build failed. Incorrect configuration."});return s._name=t,this._childApps[t]=s,s.on("destroy",_.partial(this._removeChildApp,t),this),this.isRunning()&&_.result(s,"startWithParent")&&s.start(),s},getName:function(){return this._name},getChildApps:function(){return _.clone(this._childApps)},getChildApp:function(t){return this._childApps[t]},_removeChildApp:function(t){delete this._childApps[t]._name,delete this._childApps[t]},removeChildApps:function(){var t=this.getChildApps();return _.each(this._childApps,function(t,e){this.removeChildApp(e)},this),t},removeChildApp:function(t,e){e=e||{};var i=this.getChildApp(t);if(i)return e.preventDestroy||_.result(i,"preventDestroy")?this._removeChildApp(t):i.destroy(),i}}),app=App;module.exports=app; | ||
"use strict";var _=require("underscore"),Marionette=require("backbone.marionette"),StateClass=require("marionette.toolkit.state-class"),AbstractApp=StateClass.extend({_isRunning:!1,_isDestroyed:!1,preventDestroy:!1,startAfterInitialized:!1,startWithParent:!1,stopWithParent:!0,constructor:function(t){t=_.extend({},t),_.bindAll(this,"start","stop");var e=["startWithParent","stopWithParent","startAfterInitialized","preventDestroy"];_.extend(this,_.pick(t,e)),StateClass.call(this,t),_.result(this,"startAfterInitialized")&&this.start(t)},_ensureAppIsIntact:function(){if(this._isDestroyed)throw new Marionette.Error({name:"AppDestroyedError",message:"App has already been destroyed and cannot be used."})},isRunning:function(){return this._isRunning},start:function(t){return this._ensureAppIsIntact(),this._isRunning?this:(this.triggerMethod("before:start",t),this._isRunning=!0,this.triggerStart(t),this)},triggerStart:function(t){this.triggerMethod("start",t)},stop:function(t){return this._isRunning?(this.triggerMethod("before:stop",t),this._isRunning=!1,this.triggerMethod("stop",t),this._stopRunningListeners(),this._stopRunningEvents(),this):this},isDestroyed:function(){return this._isDestroyed},destroy:function(){this._isDestroyed||(this._isDestroyed=!0,this.stop(),StateClass.prototype.destroy.apply(this,arguments))},_stopRunningEvents:function(){_.each(this._runningEvents,function(t){this.off.apply(this,t)},this)},_stopRunningListeners:function(){_.each(this._runningListeningTo,function(t){this.stopListening.apply(this,t)},this)},on:function(){return this._isRunning&&(this._runningEvents=this._runningEvents||[],this._runningEvents.push(arguments)),StateClass.prototype.on.apply(this,arguments)},listenTo:function(){return this._isRunning&&(this._runningListeningTo=this._runningListeningTo||[],this._runningListeningTo.push(arguments)),StateClass.prototype.listenTo.apply(this,arguments)},listenToOnce:function(){return this._isRunning&&(this._runningListeningTo=this._runningListeningTo||[],this._runningListeningTo.push(arguments)),StateClass.prototype.listenToOnce.apply(this,arguments)}}),abstract_app=AbstractApp,App=abstract_app.extend({constructor:function(t){t=_.extend({},t),this._childApps={},_.extend(this,_.pick(t,["childApps"])),this._initChildApps(t),this.on({start:this._startChildApps,"before:stop":this._stopChildApps,"before:destroy":this._destroyChildApps}),abstract_app.call(this,t)},_initChildApps:function(t){var e=this.childApps;e&&(_.isFunction(e)&&(e=e.call(this,t)),this.addChildApps(e))},_startChildApps:function(){_.each(this._childApps,function(t){_.result(t,"startWithParent")&&t.start()})},_stopChildApps:function(){_.each(this._childApps,function(t){_.result(t,"stopWithParent")&&t.stop()})},_destroyChildApps:function(){_.each(this._childApps,function(t){_.result(t,"preventDestroy")||t.destroy()})},_buildAppFromObject:function(t){var e=t.AppClass,i=_.omit(t,"AppClass");return this.buildApp(e,i)},_buildApp:function(t,e){return _.isFunction(t)?this.buildApp(t,e):_.isObject(t)?this._buildAppFromObject(t):void 0},buildApp:function(t,e){return new t(e)},_ensureAppIsUnique:function(t){if(this._childApps[t])throw new Marionette.Error({name:"DuplicateChildAppError",message:'A child App with name "'+t+'" has already been added.'})},addChildApps:function(t){_.each(t,function(t,e){this.addChildApp(e,t)},this)},addChildApp:function(t,e,i){this._ensureAppIsUnique(t);var s=this._buildApp(e,i);if(!s)throw new Marionette.Error({name:"AddChildAppError",message:"App build failed. Incorrect configuration."});return s._name=t,this._childApps[t]=s,s.on("destroy",_.partial(this._removeChildApp,t),this),this.isRunning()&&_.result(s,"startWithParent")&&s.start(),s},getName:function(){return this._name},getChildApps:function(){return _.clone(this._childApps)},getChildApp:function(t){return this._childApps[t]},_removeChildApp:function(t){delete this._childApps[t]._name,delete this._childApps[t]},removeChildApps:function(){var t=this.getChildApps();return _.each(this._childApps,function(t,e){this.removeChildApp(e)},this),t},removeChildApp:function(t,e){e=_.extend({},e);var i=this.getChildApp(t);if(i)return e.preventDestroy||_.result(i,"preventDestroy")?this._removeChildApp(t):i.destroy(),i}}),app=App;module.exports=app; | ||
//# sourceMappingURL=App.min.js.map |
{ | ||
"name": "marionette.toolkit.app", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Marionette.Toolkit’s `App` as a module.", | ||
@@ -20,5 +20,5 @@ "main": "./App.js", | ||
"backbone.marionette": "^2.1.0", | ||
"backbone": "1.0.0 - 1.1.2", | ||
"underscore": "1.4.4 - 1.8.3" | ||
"backbone": "^1.0.0", | ||
"underscore": "^1.4.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Marionette.Toolkit.App v0.4.0 | ||
# Marionette.Toolkit.App v0.4.1 | ||
@@ -3,0 +3,0 @@ [Marionette.Toolkit](https://github.com/RoundingWellOS/marionette.toolkit)'s `App` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.4.0 | ||
* @version v0.4.1 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
@@ -51,3 +51,3 @@ * @license MIT | ||
constructor: function constructor(stateAttrs, options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -157,3 +157,3 @@ // Make defaults available to this | ||
_getViewClass: function _getViewClass(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -160,0 +160,0 @@ var ViewClass = this.getOption("ViewClass"); |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.4.0 | ||
* @version v0.4.1 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
* @license MIT | ||
*/ | ||
"use strict";var _=require("underscore"),Backbone=require("backbone"),Marionette=require("backbone.marionette"),StateClass=require("marionette.toolkit.state-class"),Component=StateClass.extend({ViewClass:Marionette.ItemView,viewEventPrefix:"view",viewOptions:{},constructor:function(e,t){t=t||{},_.extend(this,_.pick(t,["viewEventPrefix","ViewClass","viewOptions","region"])),StateClass.call(this,t),this._setStateDefaults(e)},_shouldDestroy:!0,_setStateDefaults:function(e){this.setState(e,{silent:!0})},showIn:function(e,t){return this.region=e,this.show(t),this},show:function(e){if(this._isShown)throw new Marionette.Error({name:"ComponentShowError",message:"Component has already been shown in a region."});if(!this.region)throw new Marionette.Error({name:"ComponentRegionError",message:"Component has no defined region."});return this.triggerMethod("before:show"),this.renderView(e),this._isShown=!0,this.triggerMethod("show"),this.listenTo(this.region,"empty",this._destroy),this},_getViewClass:function(e){e=e||{};var t=this.getOption("ViewClass");if(t.prototype instanceof Backbone.View||t===Backbone.View)return t;if(_.isFunction(t))return t.call(this,e);throw new Marionette.Error({name:"InvalidViewClassError",message:'"ViewClass" must be a view class or a function that returns a view class'})},renderView:function(e){var t=this._getViewClass(e),i=this.mixinOptions(e),s=this.buildView(t,i);return this.currentView=s,this._proxyViewEvents(s),this.triggerMethod("before:render:view",s),this._shouldDestroy=!1,this.region.show(s),this._shouldDestroy=!0,this.triggerMethod("render:view",s),this},_proxyViewEvents:function(e){var t=this.getOption("viewEventPrefix");e.on("all",function(){var i=_.toArray(arguments),s=i[0];i[0]=t+":"+s,i.splice(1,0,e),this.triggerMethod.apply(this,i)},this)},mixinOptions:function(e){var t=_.result(this,"viewOptions");return _.extend({stateModel:this.getState()},t,e)},buildView:function(e,t){return new e(t)},_destroy:function(){this._shouldDestroy&&StateClass.prototype.destroy.apply(this,arguments)},_emptyRegion:function(e){this.region&&(this.stopListening(this.region,"empty"),this.region.empty(e))},destroy:function(e){this._emptyRegion(e),this._shouldDestroy=!0,this._destroy(e)}}),component=Component;module.exports=component; | ||
"use strict";var _=require("underscore"),Backbone=require("backbone"),Marionette=require("backbone.marionette"),StateClass=require("marionette.toolkit.state-class"),Component=StateClass.extend({ViewClass:Marionette.ItemView,viewEventPrefix:"view",viewOptions:{},constructor:function(e,t){t=_.extend({},t),_.extend(this,_.pick(t,["viewEventPrefix","ViewClass","viewOptions","region"])),StateClass.call(this,t),this._setStateDefaults(e)},_shouldDestroy:!0,_setStateDefaults:function(e){this.setState(e,{silent:!0})},showIn:function(e,t){return this.region=e,this.show(t),this},show:function(e){if(this._isShown)throw new Marionette.Error({name:"ComponentShowError",message:"Component has already been shown in a region."});if(!this.region)throw new Marionette.Error({name:"ComponentRegionError",message:"Component has no defined region."});return this.triggerMethod("before:show"),this.renderView(e),this._isShown=!0,this.triggerMethod("show"),this.listenTo(this.region,"empty",this._destroy),this},_getViewClass:function(e){e=_.extend({},e);var t=this.getOption("ViewClass");if(t.prototype instanceof Backbone.View||t===Backbone.View)return t;if(_.isFunction(t))return t.call(this,e);throw new Marionette.Error({name:"InvalidViewClassError",message:'"ViewClass" must be a view class or a function that returns a view class'})},renderView:function(e){var t=this._getViewClass(e),i=this.mixinOptions(e),s=this.buildView(t,i);return this.currentView=s,this._proxyViewEvents(s),this.triggerMethod("before:render:view",s),this._shouldDestroy=!1,this.region.show(s),this._shouldDestroy=!0,this.triggerMethod("render:view",s),this},_proxyViewEvents:function(e){var t=this.getOption("viewEventPrefix");e.on("all",function(){var i=_.toArray(arguments),s=i[0];i[0]=t+":"+s,i.splice(1,0,e),this.triggerMethod.apply(this,i)},this)},mixinOptions:function(e){var t=_.result(this,"viewOptions");return _.extend({stateModel:this.getState()},t,e)},buildView:function(e,t){return new e(t)},_destroy:function(){this._shouldDestroy&&StateClass.prototype.destroy.apply(this,arguments)},_emptyRegion:function(e){this.region&&(this.stopListening(this.region,"empty"),this.region.empty(e))},destroy:function(e){this._emptyRegion(e),this._shouldDestroy=!0,this._destroy(e)}}),component=Component;module.exports=component; | ||
//# sourceMappingURL=Component.min.js.map |
{ | ||
"name": "marionette.toolkit.component", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Marionette.Toolkit’s `Component` as a module.", | ||
@@ -20,5 +20,5 @@ "main": "./Component.js", | ||
"backbone.marionette": "^2.1.0", | ||
"backbone": "1.0.0 - 1.1.2", | ||
"underscore": "1.4.4 - 1.8.3" | ||
"backbone": "^1.0.0", | ||
"underscore": "^1.4.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Marionette.Toolkit.Component v0.4.0 | ||
# Marionette.Toolkit.Component v0.4.1 | ||
@@ -3,0 +3,0 @@ [Marionette.Toolkit](https://github.com/RoundingWellOS/marionette.toolkit)'s `Component` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. |
{ | ||
"name": "marionette.toolkit.state-class", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Marionette.Toolkit’s `StateClass` as a module.", | ||
@@ -20,5 +20,5 @@ "main": "./StateClass.js", | ||
"backbone.marionette": "^2.1.0", | ||
"backbone": "1.0.0 - 1.1.2", | ||
"underscore": "1.4.4 - 1.8.3" | ||
"backbone": "^1.0.0", | ||
"underscore": "^1.4.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Marionette.Toolkit.StateClass v0.4.0 | ||
# Marionette.Toolkit.StateClass v0.4.1 | ||
@@ -3,0 +3,0 @@ [Marionette.Toolkit](https://github.com/RoundingWellOS/marionette.toolkit)'s `StateClass` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.4.0 | ||
* @version v0.4.1 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
@@ -30,3 +30,3 @@ * @license MIT | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -33,0 +33,0 @@ // Make defaults available to this |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.4.0 | ||
* @version v0.4.1 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
* @license MIT | ||
*/ | ||
"use strict";var _=require("underscore"),Backbone=require("backbone"),Marionette=require("backbone.marionette"),StateClass=Marionette.Object.extend({StateModel:Backbone.Model,constructor:function(t){t=t||{},_.extend(this,_.pick(t,["StateModel","stateEvents","stateDefaults"]));var e=this._getStateModel(t);this._stateModel=new e(_.result(this,"stateDefaults")),this.bindEntityEvents(this._stateModel,_.result(this,"stateEvents")),Marionette.Object.call(this,t)},_getStateModel:function(t){var e=this.getOption("StateModel");if(e.prototype instanceof Backbone.Model||e===Backbone.Model)return e;if(_.isFunction(e))return e.call(this,t);throw new Marionette.Error({name:"InvalidStateModelError",message:'"StateModel" must be a model class or a function that returns a model class'})},setState:function(){return this._stateModel.set.apply(this._stateModel,arguments)},getState:function(t){return t?this._stateModel.get.apply(this._stateModel,arguments):this._stateModel},destroy:function(){this._stateModel.stopListening(),Marionette.Object.prototype.destroy.apply(this,arguments)}}),state_class=StateClass;module.exports=state_class; | ||
"use strict";var _=require("underscore"),Backbone=require("backbone"),Marionette=require("backbone.marionette"),StateClass=Marionette.Object.extend({StateModel:Backbone.Model,constructor:function(t){t=_.extend({},t),_.extend(this,_.pick(t,["StateModel","stateEvents","stateDefaults"]));var e=this._getStateModel(t);this._stateModel=new e(_.result(this,"stateDefaults")),this.bindEntityEvents(this._stateModel,_.result(this,"stateEvents")),Marionette.Object.call(this,t)},_getStateModel:function(t){var e=this.getOption("StateModel");if(e.prototype instanceof Backbone.Model||e===Backbone.Model)return e;if(_.isFunction(e))return e.call(this,t);throw new Marionette.Error({name:"InvalidStateModelError",message:'"StateModel" must be a model class or a function that returns a model class'})},setState:function(){return this._stateModel.set.apply(this._stateModel,arguments)},getState:function(t){return t?this._stateModel.get.apply(this._stateModel,arguments):this._stateModel},destroy:function(){this._stateModel.stopListening(),Marionette.Object.prototype.destroy.apply(this,arguments)}}),state_class=StateClass;module.exports=state_class; | ||
//# sourceMappingURL=StateClass.min.js.map |
@@ -76,3 +76,3 @@ import _ from 'underscore'; | ||
constructor: function(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -79,0 +79,0 @@ _.bindAll(this, 'start', 'stop'); |
@@ -33,3 +33,3 @@ import _ from 'underscore'; | ||
constructor: function(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -324,3 +324,3 @@ this._childApps = {}; | ||
removeChildApp: function(appName, options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -327,0 +327,0 @@ var childApp = this.getChildApp(appName); |
@@ -51,3 +51,3 @@ import _ from 'underscore'; | ||
constructor: function(stateAttrs, options){ | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -157,3 +157,3 @@ // Make defaults available to this | ||
_getViewClass: function(options) { | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -160,0 +160,0 @@ var ViewClass = this.getOption('ViewClass'); |
@@ -30,3 +30,3 @@ import _ from 'underscore'; | ||
constructor: function(options){ | ||
options = options || {}; | ||
options = _.extend({}, options); | ||
@@ -33,0 +33,0 @@ // Make defaults available to this |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
450843
63
4034
+ Addedbackbone@1.3.31.6.0(transitive)
+ Addedunderscore@1.13.7(transitive)
- Removedbackbone@1.1.2(transitive)
Updatedbackbone@^1.0.0
Updatedunderscore@^1.4.4