From eed4862845bbb8ee58527f5548c1bcc8510219ac Mon Sep 17 00:00:00 2001 From: vash15 Date: Tue, 22 Nov 2016 17:50:25 +0100 Subject: [PATCH] Add new method getActiveViewWithOptions --- README.md | 14 +++++++++++++- bower.json | 2 +- lib/viewstack.js | 4 ++++ package.json | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 627447f..613966a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,19 @@ Return the last view. ### getViewActive Return the active view. -Ritorna la view attiva. It can be active only one view. + +## getActiveViewWithOptions +Return an object + +``` + { + "view": `instance of Backbone.View`, + "options": { + animated: true, + ... + } + } +``` ### getViewAtIndex(index) Return the view at index. diff --git a/bower.json b/bower.json index c66b93c..bbae116 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "backbone.viewstack", - "version": "2.2.1", + "version": "2.3.0", "homepage": "https://github.com/vash15/backbone.viewstack", "authors": [ "Michele Belluco ", diff --git a/lib/viewstack.js b/lib/viewstack.js index aeb529a..c06d660 100644 --- a/lib/viewstack.js +++ b/lib/viewstack.js @@ -131,6 +131,10 @@ return this._current; }, + getActiveViewWithOptions: function getActiveViewWithOptions() { + return this._stack[ this._stack.length-1 ]; + }, + getViewAtIndex: function getViewAtIndex(index){ var element = this._stack[index]; if ( _.isObject(element) ) diff --git a/package.json b/package.json index f209216..a677dfe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backbone.viewstack", - "version": "2.2.1", + "version": "2.3.0", "description": "View stack for Backbone", "main": "lib/viewstack.js", "repository": {