From 25e4df27a424ab6eacc12378c1b577e16902d910 Mon Sep 17 00:00:00 2001 From: Steve Orvell Date: Mon, 6 Jan 2014 12:58:54 -0800 Subject: [PATCH] Add support for attached/detachedCallbacks; users can now implement attached/detached; in addition, entered/leftView remain available for bc. --- src/instance/base.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/instance/base.js b/src/instance/base.js index 7dd5088..d887ff6 100644 --- a/src/instance/base.js +++ b/src/instance/base.js @@ -45,32 +45,48 @@ // user entry point this.ready(); }, - enteredViewCallback: function() { + attachedCallback: function() { if (!this._elementPrepared) { this.prepareElement(); } this.cancelUnbindAll(true); // invoke user action + if (this.attached) { + this.attached(); + } + // TODO(sorvell): bc if (this.enteredView) { this.enteredView(); } }, - leftViewCallback: function() { + detachedCallback: function() { if (!this.preventDispose) { this.asyncUnbindAll(); } // invoke user action + if (this.detached) { + this.detached(); + } + // TODO(sorvell): bc if (this.leftView) { this.leftView(); } }, // TODO(sorvell): bc + enteredViewCallback: function() { + this.attachedCallback(); + }, + // TODO(sorvell): bc + leftViewCallback: function() { + this.detachedCallback(); + }, + // TODO(sorvell): bc enteredDocumentCallback: function() { - this.enteredViewCallback(); + this.attachedCallback(); }, // TODO(sorvell): bc leftDocumentCallback: function() { - this.leftViewCallback(); + this.detachedCallback(); }, // recursive ancestral initialization, oldest first parseDeclarations: function(p) {