Created
November 5, 2012 17:25
-
-
Save tonylukasavage/4018538 to your computer and use it in GitHub Desktop.
Memory management fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openView1(e) | |
{ | |
// $.view1 = Alloy.createController('view1'); // create controller | |
// $.rootwindow.add($.view1.getView()); // add View1 to Window | |
// VARS.GVUpdate("globalCurrentView", $.view1.getView()); // Update ref to view2 | |
var view1 = Alloy.createController('view1'); // create controller | |
$.rootwindow.add(view1.getView()); // add View1 to Window | |
VARS.GVUpdate("globalCurrentView", view1.getView()); // Update ref to view2 | |
} | |
var VARS = require('Globals'); // Ref Globals | |
VARS.GVUpdate("globalParent", $.rootwindow); // Update Parent to store ref to Window | |
// open Main App Window | |
$.rootwindow.open(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openView2(e) | |
{ | |
var VARS = require('Globals'); // Ref Globals | |
// $.view2 = Alloy.createController('view2'); // Ref View2 to load it | |
// VARS.GV.globalParent.add($.view2.getView()); // Add View 2 to Window | |
var view2 = Alloy.createController('view2'); // Ref View2 to load it | |
VARS.GV.globalParent.add(view2.getView()); // Add View 2 to Window | |
// remove view 1 | |
VARS.GVUpdate("closeView", new VARS.GV.CloseView(VARS.GV.globalParent, VARS.GV.globalCurrentView)); | |
VARS.GVUpdate("closeView", null); | |
VARS.GVUpdate("globalCurrentView", view2.getView()); // Update ref to view2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function closeView2(e) | |
{ | |
// reopen view1 and add to window | |
var VARS = require('Globals'); // Ref Globals | |
// $.view1 = Alloy.createController('view1'); // Ref View1 to load it | |
// VARS.GV.globalParent.add($.view1.getView()); // Add View 1 to Window | |
var view1 = Alloy.createController('view1'); // Ref View1 to load it | |
VARS.GV.globalParent.add(view1.getView()); // Add View 1 to Window | |
// close view 2 | |
var VARS = require('Globals'); | |
VARS.GVUpdate("closeView", new VARS.GV.CloseView(VARS.GV.globalParent, VARS.GV.globalCurrentView)); | |
VARS.GVUpdate("closeView", null); | |
// VARS.GVUpdate("globalCurrentView", $.view1.getView()); // Update ref to view1 | |
VARS.GVUpdate("globalCurrentView", view1.getView()); // Update ref to view1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment