marionette.toolkit
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -0,1 +1,5 @@ | ||
#### v0.2.2 | ||
* Bug Fix - Passed in options to child app on start | ||
#### v0.2.1 | ||
@@ -2,0 +6,0 @@ |
/** | ||
* marionette.toolkit - A collection of opinionated Backbone.Marionette extensions for large scale application architecture. | ||
* @version v0.2.1 | ||
* @version v0.2.2 | ||
* @link https://github.com/RoundingWellOS/marionette.toolkit | ||
@@ -28,3 +28,3 @@ * @license MIT | ||
*/ | ||
constructor: function (options) { | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
@@ -55,3 +55,3 @@ | ||
*/ | ||
getStateModelClass: function () { | ||
getStateModelClass: function getStateModelClass() { | ||
return this.StateModel; | ||
@@ -71,3 +71,3 @@ }, | ||
*/ | ||
setState: function () { | ||
setState: function setState() { | ||
return this._stateModel.set.apply(this._stateModel, arguments); | ||
@@ -85,3 +85,3 @@ }, | ||
*/ | ||
getState: function (attr) { | ||
getState: function getState(attr) { | ||
if (!attr) { | ||
@@ -101,3 +101,3 @@ return this._stateModel; | ||
*/ | ||
destroy: function () { | ||
destroy: function destroy() { | ||
this._stateModel.stopListening(); | ||
@@ -170,3 +170,3 @@ | ||
*/ | ||
constructor: function (options) { | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
@@ -196,3 +196,3 @@ | ||
*/ | ||
_ensureAppIsIntact: function () { | ||
_ensureAppIsIntact: function _ensureAppIsIntact() { | ||
if (this._isDestroyed) { | ||
@@ -214,3 +214,3 @@ throw new Marionette.Error({ | ||
*/ | ||
isRunning: function () { | ||
isRunning: function isRunning() { | ||
return this._isRunning; | ||
@@ -229,3 +229,3 @@ }, | ||
*/ | ||
start: function (options) { | ||
start: function start(options) { | ||
this._ensureAppIsIntact(); | ||
@@ -257,3 +257,3 @@ | ||
*/ | ||
triggerStart: function (options) { | ||
triggerStart: function triggerStart(options) { | ||
this.triggerMethod("start", options); | ||
@@ -274,3 +274,3 @@ }, | ||
*/ | ||
stop: function (options) { | ||
stop: function stop(options) { | ||
if (!this._isRunning) { | ||
@@ -300,3 +300,3 @@ return this; | ||
*/ | ||
isDestroyed: function () { | ||
isDestroyed: function isDestroyed() { | ||
return this._isDestroyed; | ||
@@ -312,3 +312,3 @@ }, | ||
*/ | ||
destroy: function () { | ||
destroy: function destroy() { | ||
this.stop(); | ||
@@ -328,3 +328,3 @@ | ||
*/ | ||
_stopRunningEvents: function () { | ||
_stopRunningEvents: function _stopRunningEvents() { | ||
_.each(this._runningEvents, function (args) { | ||
@@ -342,3 +342,3 @@ this.off.apply(this, args); | ||
*/ | ||
_stopRunningListeners: function () { | ||
_stopRunningListeners: function _stopRunningListeners() { | ||
_.each(this._runningListeningTo, function (args) { | ||
@@ -358,3 +358,3 @@ this.stopListening.apply(this, args); | ||
*/ | ||
on: function () { | ||
on: function on() { | ||
if (this._isRunning) { | ||
@@ -376,3 +376,3 @@ this._runningEvents = this._runningEvents || []; | ||
*/ | ||
listenTo: function () { | ||
listenTo: function listenTo() { | ||
if (this._isRunning) { | ||
@@ -394,3 +394,3 @@ this._runningListeningTo = this._runningListeningTo || []; | ||
*/ | ||
listenToOnce: function () { | ||
listenToOnce: function listenToOnce() { | ||
if (this._isRunning) { | ||
@@ -424,3 +424,3 @@ this._runningListeningTo = this._runningListeningTo || []; | ||
*/ | ||
constructor: function (options) { | ||
constructor: function constructor(options) { | ||
options = options || {}; | ||
@@ -452,3 +452,3 @@ | ||
*/ | ||
_initChildApps: function () { | ||
_initChildApps: function _initChildApps() { | ||
if (this.childApps) { | ||
@@ -466,3 +466,3 @@ this.addChildApps(_.result(this, "childApps")); | ||
*/ | ||
_startChildApps: function () { | ||
_startChildApps: function _startChildApps() { | ||
_.each(this._childApps, function (childApp) { | ||
@@ -482,3 +482,3 @@ if (_.result(childApp, "startWithParent")) { | ||
*/ | ||
_stopChildApps: function () { | ||
_stopChildApps: function _stopChildApps() { | ||
_.each(this._childApps, function (childApp) { | ||
@@ -498,3 +498,3 @@ if (_.result(childApp, "stopWithParent")) { | ||
*/ | ||
_destroyChildApps: function () { | ||
_destroyChildApps: function _destroyChildApps() { | ||
_.each(this._childApps, function (childApp) { | ||
@@ -516,3 +516,3 @@ if (!_.result(childApp, "preventDestroy")) { | ||
*/ | ||
_buildAppFromObject: function (appConfig) { | ||
_buildAppFromObject: function _buildAppFromObject(appConfig) { | ||
var AppClass = appConfig.AppClass; | ||
@@ -535,3 +535,3 @@ var options = _.omit(appConfig, "AppClass"); | ||
*/ | ||
_buildApp: function (AppClass, options) { | ||
_buildApp: function _buildApp(AppClass, options) { | ||
if (_.isFunction(AppClass)) { | ||
@@ -556,3 +556,3 @@ return this.buildApp(AppClass, options); | ||
*/ | ||
buildApp: function (AppClass, options) { | ||
buildApp: function buildApp(AppClass, options) { | ||
return new AppClass(options); | ||
@@ -570,3 +570,3 @@ }, | ||
*/ | ||
_ensureAppIsUnique: function (appName) { | ||
_ensureAppIsUnique: function _ensureAppIsUnique(appName) { | ||
if (this._childApps[appName]) { | ||
@@ -588,3 +588,3 @@ throw new Marionette.Error({ | ||
*/ | ||
addChildApps: function (childApps) { | ||
addChildApps: function addChildApps(childApps) { | ||
_.each(childApps, function (childApp, appName) { | ||
@@ -609,3 +609,3 @@ this.addChildApp(appName, childApp); | ||
*/ | ||
addChildApp: function (appName, AppClass, options) { | ||
addChildApp: function addChildApp(appName, AppClass, options) { | ||
this._ensureAppIsUnique(appName); | ||
@@ -628,3 +628,3 @@ | ||
if (this.isRunning() && _.result(childApp, "startWithParent")) { | ||
childApp.start(); | ||
childApp.start(options); | ||
} | ||
@@ -643,3 +643,3 @@ | ||
*/ | ||
getChildApps: function () { | ||
getChildApps: function getChildApps() { | ||
return _.clone(this._childApps); | ||
@@ -657,3 +657,3 @@ }, | ||
*/ | ||
getChildApp: function (appName) { | ||
getChildApp: function getChildApp(appName) { | ||
return this._childApps[appName]; | ||
@@ -671,3 +671,3 @@ }, | ||
*/ | ||
_removeChildApp: function (appName) { | ||
_removeChildApp: function _removeChildApp(appName) { | ||
delete this._childApps[appName]; | ||
@@ -685,3 +685,3 @@ }, | ||
*/ | ||
removeChildApps: function () { | ||
removeChildApps: function removeChildApps() { | ||
var childApps = this.getChildApps(); | ||
@@ -707,3 +707,3 @@ | ||
*/ | ||
removeChildApp: function (appName, options) { | ||
removeChildApp: function removeChildApp(appName, options) { | ||
options = options || {}; | ||
@@ -765,3 +765,3 @@ | ||
*/ | ||
constructor: function (stateAttrs, options) { | ||
constructor: function constructor(stateAttrs, options) { | ||
options = options || {}; | ||
@@ -796,3 +796,3 @@ | ||
*/ | ||
_setStateDefaults: function (stateAttrs) { | ||
_setStateDefaults: function _setStateDefaults(stateAttrs) { | ||
this.setState(stateAttrs, { silent: true }); | ||
@@ -811,3 +811,3 @@ }, | ||
*/ | ||
showIn: function (region, viewOptions) { | ||
showIn: function showIn(region, viewOptions) { | ||
this.region = region; | ||
@@ -833,3 +833,3 @@ | ||
*/ | ||
show: function (viewOptions) { | ||
show: function show(viewOptions) { | ||
if (this._isShown) { | ||
@@ -874,3 +874,3 @@ throw new Marionette.Error({ | ||
*/ | ||
renderView: function (options) { | ||
renderView: function renderView(options) { | ||
var viewOptions = this.mixinOptions(options); | ||
@@ -912,3 +912,3 @@ | ||
*/ | ||
_proxyViewEvents: function (view) { | ||
_proxyViewEvents: function _proxyViewEvents(view) { | ||
var prefix = this.getOption("viewEventPrefix"); | ||
@@ -937,3 +937,3 @@ | ||
*/ | ||
mixinOptions: function (options) { | ||
mixinOptions: function mixinOptions(options) { | ||
var viewOptions = _.result(this, "viewOptions"); | ||
@@ -957,3 +957,3 @@ | ||
*/ | ||
buildView: function (ViewClass, viewOptions) { | ||
buildView: function buildView(ViewClass, viewOptions) { | ||
return new ViewClass(viewOptions); | ||
@@ -969,3 +969,3 @@ }, | ||
*/ | ||
_destroy: function () { | ||
_destroy: function _destroy() { | ||
if (this._shouldDestroy) { | ||
@@ -984,3 +984,3 @@ StateClass.prototype.destroy.apply(this, arguments); | ||
*/ | ||
_emptyRegion: function (options) { | ||
_emptyRegion: function _emptyRegion(options) { | ||
if (this.region) { | ||
@@ -1000,3 +1000,3 @@ this.stopListening(this.region, "empty"); | ||
*/ | ||
destroy: function (options) { | ||
destroy: function destroy(options) { | ||
this._emptyRegion(options); | ||
@@ -1003,0 +1003,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("backbone.marionette"),require("underscore"),require("backbone")):"function"==typeof define&&define.amd?define(["backbone.marionette","underscore","backbone"],i):i(t.Marionette,t._,t.Backbone)}(this,function(t,i,e){"use strict";var n=t.Object.extend({StateModel:e.Model,constructor:function(e){e=e||{},i.extend(this,i.pick(e,["StateModel","stateEvents","stateDefaults"]));var n=this.getStateModelClass();this._stateModel=new n(i.result(this,"stateDefaults")),this.bindEntityEvents(this._stateModel,i.result(this,"stateEvents")),t.Object.call(this,e)},getStateModelClass:function(){return this.StateModel},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)}}),s=n.extend({_isRunning:!1,_isDestroyed:!1,preventDestroy:!1,startAfterInitialized:!1,startWithParent:!1,stopWithParent:!0,constructor:function(t){t=t||{},i.bindAll(this,"start","stop");var e=["startWithParent","stopWithParent","startAfterInitialized","preventDestroy"];i.extend(this,i.pick(t,e)),n.call(this,t),i.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.stop(),this._isDestroyed=!0,n.prototype.destroy.apply(this,arguments)},_stopRunningEvents:function(){i.each(this._runningEvents,function(t){this.off.apply(this,t)},this)},_stopRunningListeners:function(){i.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)}}),r=s.extend({constructor:function(t){t=t||{},this._childApps={},i.extend(this,i.pick(t,["childApps"])),this._initChildApps(),this.on({start:this._startChildApps,"before:stop":this._stopChildApps,"before:destroy":this._destroyChildApps}),s.call(this,t)},_initChildApps:function(){this.childApps&&this.addChildApps(i.result(this,"childApps"))},_startChildApps:function(){i.each(this._childApps,function(t){i.result(t,"startWithParent")&&t.start()})},_stopChildApps:function(){i.each(this._childApps,function(t){i.result(t,"stopWithParent")&&t.stop()})},_destroyChildApps:function(){i.each(this._childApps,function(t){i.result(t,"preventDestroy")||t.destroy()})},_buildAppFromObject:function(t){var e=t.AppClass,n=i.omit(t,"AppClass");return this.buildApp(e,n)},_buildApp:function(t,e){return i.isFunction(t)?this.buildApp(t,e):i.isObject(t)?this._buildAppFromObject(t):void 0},buildApp:function(t,i){return new t(i)},_ensureAppIsUnique:function(i){if(this._childApps[i])throw new t.Error({name:"DuplicateChildAppError",message:"A child App with that name has already been added."})},addChildApps:function(t){i.each(t,function(t,i){this.addChildApp(i,t)},this)},addChildApp:function(e,n,s){this._ensureAppIsUnique(e);var r=this._buildApp(n,s);if(!r)throw new t.Error({name:"AddChildAppError",message:"App build failed. Incorrect configuration."});return this._childApps[e]=r,r.on("destroy",i.partial(this._removeChildApp,e),this),this.isRunning()&&i.result(r,"startWithParent")&&r.start(),r},getChildApps:function(){return i.clone(this._childApps)},getChildApp:function(t){return this._childApps[t]},_removeChildApp:function(t){delete this._childApps[t]},removeChildApps:function(){var t=this.getChildApps();return i.each(this._childApps,function(t,i){this.removeChildApp(i)},this),t},removeChildApp:function(t,e){e=e||{};var n=this.getChildApp(t);if(n)return e.preventDestroy||i.result(n,"preventDestroy")?this._removeChildApp(t):n.destroy(),n}}),o=n.extend({ViewClass:t.ItemView,viewEventPrefix:"view",viewOptions:{},constructor:function(t,e){e=e||{},i.extend(this,i.pick(e,["viewEventPrefix","ViewClass","viewOptions","region"])),n.call(this,e),this._setStateDefaults(t)},_shouldDestroy:!0,_setStateDefaults:function(t){this.setState(t,{silent:!0})},showIn:function(t,i){return this.region=t,this.show(i),this},show:function(i){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(i),this._isShown=!0,this.triggerMethod("show"),this.listenTo(this.region,"empty",this._destroy),this},renderView:function(t){var i=this.mixinOptions(t),e=this.buildView(this.ViewClass,i);return this.currentView=e,this._proxyViewEvents(e),this.triggerMethod("before:render:view",e),this._shouldDestroy=!1,this.region.show(e),this._shouldDestroy=!0,this.triggerMethod("render:view",e),this},_proxyViewEvents:function(t){var e=this.getOption("viewEventPrefix");t.on("all",function(){var n=i.toArray(arguments),s=n[0];n[0]=e+":"+s,n.splice(1,0,t),this.triggerMethod.apply(this,n)},this)},mixinOptions:function(t){var e=i.result(this,"viewOptions");return i.extend({stateModel:this.getState()},e,t)},buildView:function(t,i){return new t(i)},_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)}}),h=t.Toolkit,p=t.Toolkit={};p.noConflict=function(){return t.Toolkit=h,this},p.StateClass=n,p.App=r,p.Component=o}); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("backbone.marionette"),require("underscore"),require("backbone")):"function"==typeof define&&define.amd?define(["backbone.marionette","underscore","backbone"],i):i(t.Marionette,t._,t.Backbone)}(this,function(t,i,e){"use strict";var n=t.Object.extend({StateModel:e.Model,constructor:function(e){e=e||{},i.extend(this,i.pick(e,["StateModel","stateEvents","stateDefaults"]));var n=this.getStateModelClass();this._stateModel=new n(i.result(this,"stateDefaults")),this.bindEntityEvents(this._stateModel,i.result(this,"stateEvents")),t.Object.call(this,e)},getStateModelClass:function(){return this.StateModel},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)}}),s=n.extend({_isRunning:!1,_isDestroyed:!1,preventDestroy:!1,startAfterInitialized:!1,startWithParent:!1,stopWithParent:!0,constructor:function(t){t=t||{},i.bindAll(this,"start","stop");var e=["startWithParent","stopWithParent","startAfterInitialized","preventDestroy"];i.extend(this,i.pick(t,e)),n.call(this,t),i.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.stop(),this._isDestroyed=!0,n.prototype.destroy.apply(this,arguments)},_stopRunningEvents:function(){i.each(this._runningEvents,function(t){this.off.apply(this,t)},this)},_stopRunningListeners:function(){i.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)}}),r=s.extend({constructor:function(t){t=t||{},this._childApps={},i.extend(this,i.pick(t,["childApps"])),this._initChildApps(),this.on({start:this._startChildApps,"before:stop":this._stopChildApps,"before:destroy":this._destroyChildApps}),s.call(this,t)},_initChildApps:function(){this.childApps&&this.addChildApps(i.result(this,"childApps"))},_startChildApps:function(){i.each(this._childApps,function(t){i.result(t,"startWithParent")&&t.start()})},_stopChildApps:function(){i.each(this._childApps,function(t){i.result(t,"stopWithParent")&&t.stop()})},_destroyChildApps:function(){i.each(this._childApps,function(t){i.result(t,"preventDestroy")||t.destroy()})},_buildAppFromObject:function(t){var e=t.AppClass,n=i.omit(t,"AppClass");return this.buildApp(e,n)},_buildApp:function(t,e){return i.isFunction(t)?this.buildApp(t,e):i.isObject(t)?this._buildAppFromObject(t):void 0},buildApp:function(t,i){return new t(i)},_ensureAppIsUnique:function(i){if(this._childApps[i])throw new t.Error({name:"DuplicateChildAppError",message:"A child App with that name has already been added."})},addChildApps:function(t){i.each(t,function(t,i){this.addChildApp(i,t)},this)},addChildApp:function(e,n,s){this._ensureAppIsUnique(e);var r=this._buildApp(n,s);if(!r)throw new t.Error({name:"AddChildAppError",message:"App build failed. Incorrect configuration."});return this._childApps[e]=r,r.on("destroy",i.partial(this._removeChildApp,e),this),this.isRunning()&&i.result(r,"startWithParent")&&r.start(s),r},getChildApps:function(){return i.clone(this._childApps)},getChildApp:function(t){return this._childApps[t]},_removeChildApp:function(t){delete this._childApps[t]},removeChildApps:function(){var t=this.getChildApps();return i.each(this._childApps,function(t,i){this.removeChildApp(i)},this),t},removeChildApp:function(t,e){e=e||{};var n=this.getChildApp(t);if(n)return e.preventDestroy||i.result(n,"preventDestroy")?this._removeChildApp(t):n.destroy(),n}}),o=n.extend({ViewClass:t.ItemView,viewEventPrefix:"view",viewOptions:{},constructor:function(t,e){e=e||{},i.extend(this,i.pick(e,["viewEventPrefix","ViewClass","viewOptions","region"])),n.call(this,e),this._setStateDefaults(t)},_shouldDestroy:!0,_setStateDefaults:function(t){this.setState(t,{silent:!0})},showIn:function(t,i){return this.region=t,this.show(i),this},show:function(i){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(i),this._isShown=!0,this.triggerMethod("show"),this.listenTo(this.region,"empty",this._destroy),this},renderView:function(t){var i=this.mixinOptions(t),e=this.buildView(this.ViewClass,i);return this.currentView=e,this._proxyViewEvents(e),this.triggerMethod("before:render:view",e),this._shouldDestroy=!1,this.region.show(e),this._shouldDestroy=!0,this.triggerMethod("render:view",e),this},_proxyViewEvents:function(t){var e=this.getOption("viewEventPrefix");t.on("all",function(){var n=i.toArray(arguments),s=n[0];n[0]=e+":"+s,n.splice(1,0,t),this.triggerMethod.apply(this,n)},this)},mixinOptions:function(t){var e=i.result(this,"viewOptions");return i.extend({stateModel:this.getState()},e,t)},buildView:function(t,i){return new t(i)},_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)}}),h=t.Toolkit,p=t.Toolkit={};p.noConflict=function(){return t.Toolkit=h,this},p.StateClass=n,p.App=r,p.Component=o}); | ||
//# sourceMappingURL=marionette.toolkit.min.js.map |
{ | ||
"name": "marionette.toolkit", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A collection of opinionated Backbone.Marionette extensions for large scale application architecture.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/marionette.toolkit.js", |
@@ -225,3 +225,3 @@ import _ from 'underscore'; | ||
if(this.isRunning() && _.result(childApp, 'startWithParent')) { | ||
childApp.start(); | ||
childApp.start(options); | ||
} | ||
@@ -228,0 +228,0 @@ |
@@ -24,11 +24,23 @@ function createNewApp(startWParent, stopWParent, prevDestroy) { | ||
describe('and adding a childApp with startWithParent = true after parent has started', function () { | ||
it('should start the childApp', function () { | ||
beforeEach(function () { | ||
this.optionsStub = this.sinon.spy(); | ||
this.myApp = new Marionette.Toolkit.App(); | ||
this.myApp.start(); | ||
this.myApp.addChildApp('myAddedChild', Marionette.Toolkit.App, { | ||
this.ChildApp = Marionette.Toolkit.App.extend({ | ||
onStart: this.optionsStub | ||
}); | ||
this.myApp.addChildApp('myAddedChild', this.ChildApp, { | ||
startWithParent : true | ||
}); | ||
}); | ||
it('should start the childApp', function () { | ||
var test = this.myApp.getChildApp('myAddedChild'); | ||
expect(test.isRunning()).to.equal(true); | ||
}); | ||
it('should contain the options on "start"', function () { | ||
var test = { startWithParent: true }; | ||
expect(this.optionsStub.args[0][0]).to.deep.equal(test); | ||
}); | ||
}); | ||
@@ -35,0 +47,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
192445
2760
1