Browse Source

moves `onbeforeunload` callback from index.html to HLManager class >>setup

Sebastian Sastre 9 years ago
parent
commit
97bb31adf6
3 changed files with 9 additions and 7 deletions
  1. 0 4
      index.html
  2. 6 2
      src/Helios-Core.js
  3. 3 1
      src/Helios-Core.st

+ 0 - 4
index.html

@@ -22,10 +22,6 @@
             require.paths['helios/app'] = require.paths['helios/index'].replace("index", "app");
             require.callback = function () {
               require(["helios/app"], function (amber) {
-                window.onbeforeunload = function() {
-                  return 'Do you want to close Amber? All uncommitted changes will be lost.';
-                };
-
                 amber.initialize({'transport.defaultAmdNamespace': "amber_core"});
                 amber.globals.HLManager._setup();
               });

+ 6 - 2
src/Helios-Core.js

@@ -6197,6 +6197,10 @@ var $1,$2;
 $1=self._current();
 $recv($1)._setup();
 $2=$recv($1)._appendToJQuery_("body"._asJQuery());
+$recv(window)._onbeforeunload_((function(){
+return "Do you want to close Amber? All uncommitted changes will be lost.";
+
+}));
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"setup",{},$globals.HLManager.klass)});
@@ -6204,10 +6208,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "setup\x0a\x09self current \x0a\x09\x09setup;\x0a\x09\x09appendToJQuery: 'body' asJQuery",
+source: "setup\x0a\x09self current \x0a\x09\x09setup;\x0a\x09\x09appendToJQuery: 'body' asJQuery.\x0a\x09\x09\x0a\x09window onbeforeunload:[ 'Do you want to close Amber? All uncommitted changes will be lost.' ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["setup", "current", "appendToJQuery:", "asJQuery"]
+messageSends: ["setup", "current", "appendToJQuery:", "asJQuery", "onbeforeunload:"]
 }),
 $globals.HLManager.klass);
 

+ 3 - 1
src/Helios-Core.st

@@ -1420,7 +1420,9 @@ current
 setup
 	self current 
 		setup;
-		appendToJQuery: 'body' asJQuery
+		appendToJQuery: 'body' asJQuery.
+		
+	window onbeforeunload:[ 'Do you want to close Amber? All uncommitted changes will be lost.' ]
 ! !
 
 !HLManager class methodsFor: 'instance creation'!