From e0ef0cfa2d01d9765540b2f80d55ab23481d9c3d Mon Sep 17 00:00:00 2001 From: vash15 Date: Wed, 11 Jul 2018 17:15:54 +0200 Subject: [PATCH] Force the init stack --- bower.json | 2 +- lib/viewstack.js | 6 +++--- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 92b429a..ba6db30 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "backbone.viewstack", - "version": "2.3.6", + "version": "2.3.7", "homepage": "https://github.com/vash15/backbone.viewstack", "authors": [ "Michele Belluco ", diff --git a/lib/viewstack.js b/lib/viewstack.js index 951f665..ab29ed4 100644 --- a/lib/viewstack.js +++ b/lib/viewstack.js @@ -75,9 +75,9 @@ }, - initStack: function initStack(){ - if ( this._length === null ){ - this._length = this._stack.length; + initStack: function initStack(length){ + if ( this._length === null || (_.isNumber(length) && !_.isNaN(length)) ){ + this._length = _.isNumber(length) && !_.isNaN(length) ? length : this._stack.length; return this; } diff --git a/package.json b/package.json index 6089b0b..d1eaaa7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backbone.viewstack", - "version": "2.3.6", + "version": "2.3.7", "description": "View stack for Backbone", "main": "lib/viewstack.js", "repository": {