Browse Source

first version of the packaged app

Nicolas Petton 10 năm trước cách đây
mục cha
commit
551b8d7138
10 tập tin đã thay đổi với 56 bổ sung59 xóa
  1. BIN
      amber-128.png
  2. BIN
      amber-16.png
  3. 8 0
      background.js
  4. 18 0
      index.html
  5. 7 0
      load-helios.js
  6. 13 0
      manifest.json
  7. 1 1
      support/amber.js
  8. 7 47
      support/helios/src/Helios-Core.js
  9. 1 10
      support/helios/src/Helios-Core.st
  10. 1 1
      support/helpers.js

BIN
amber-128.png


BIN
amber-16.png


+ 8 - 0
background.js

@@ -0,0 +1,8 @@
+chrome.app.runtime.onLaunched.addListener(function() {
+	chrome.app.window.create('index.html', {
+		"bounds": {
+			"height": 450,
+			"width": 800
+		}
+	});
+});

+ 18 - 0
index.html

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Helios IDE</title>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <meta name="author" content="Nicolas Petton" />
+    <link type="image/x-icon" rel="shortcut icon" href="/favicon.ico"/>
+  </head>
+  <body id="helios">
+    <div id="helper">Loading Helios...</div>
+
+    <div id="includes">
+      <script type='text/javascript' src='./support/amber.js'></script>
+      <script type='text/javascript' src='./support/requirejs/require.min.js'></script>
+      <script type='text/javascript' src='./load-helios.js'></script>
+    </div>
+  </body>
+</html>

+ 7 - 0
load-helios.js

@@ -0,0 +1,7 @@
+require(
+    ["helios/set"],
+    function (smalltalk) {
+        smalltalk.initialize({'transport.defaultAmdNamespace': "amber_core"});
+		smalltalk.globals.HLManager._setup();
+    }
+);

+ 13 - 0
manifest.json

@@ -0,0 +1,13 @@
+{
+    "name": "Amber Smalltalk",
+    "description": "Amberis a Smalltalk that runs on the JS runtime",
+    "version": "0.12.6",
+    "manifest_version": 2,
+    "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
+    "app": {
+        "background": {
+            "scripts": [ "background.js" ]
+        }
+    },
+    "icons": { "16": "amber-16.png", "128": "amber-128.png" }
+}

+ 1 - 1
support/amber.js

@@ -86,7 +86,7 @@ require = function (require) {
             'helios/set': amber_home + '/support/helios/set',
             'helios/resources': amber_home + '/support/helios/resources',
             'helios/index': amber_home + '/support/helios/index',
-            'jquery': [ library_home + '/jquery/dist/jquery.min', library_home + '/jquery/jquery.min' ]
+            'jquery': [ library_home + '/jquery/jquery.min' ]
         },
         map: {
             '*': {

+ 7 - 47
support/helios/src/Helios-Core.js

@@ -3573,56 +3573,16 @@ selector: "defaultEnvironment",
 protocol: 'defaults',
 fn: function (){
 var self=this;
-var parent,parentSmalltalkGlobals;
 function $Environment(){return globals.Environment||(typeof Environment=="undefined"?nil:Environment)}
-function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$5,$4,$6,$7,$8,$9,$receiver;
-$1=_st(window)._opener();
-if(($receiver = $1) == null || $receiver.isNil){
-parent=_st(window)._parent();
-} else {
-parent=$1;
-};
-$2=parent;
-if(($receiver = $2) == null || $receiver.isNil){
-$3=_st($Environment())._new();
-$ctx1.sendIdx["new"]=1;
-return $3;
-} else {
-$2;
-};
-_st((function(){
-return smalltalk.withContext(function($ctx2) {
-$5=_st(parent)._at_("requirejs");
-$ctx2.sendIdx["at:"]=2;
-$4=_st($5)._value_("amber/boot");
-$ctx2.sendIdx["value:"]=1;
-parentSmalltalkGlobals=_st($4)._at_("globals");
-$ctx2.sendIdx["at:"]=1;
-return parentSmalltalkGlobals;
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
-return smalltalk.withContext(function($ctx2) {
-$6=_st(parent)._at_("requirejs");
-$ctx2.sendIdx["at:"]=3;
-parentSmalltalkGlobals=_st($6)._value_("amber_vm/globals");
-return parentSmalltalkGlobals;
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
-$7=parentSmalltalkGlobals;
-if(($receiver = $7) == null || $receiver.isNil){
-$8=_st($Environment())._new();
-$ctx1.sendIdx["new"]=2;
-return $8;
-} else {
-$7;
-};
-$9=_st(_st(parentSmalltalkGlobals)._at_("Environment"))._new();
-return $9;
-}, function($ctx1) {$ctx1.fill(self,"defaultEnvironment",{parent:parent,parentSmalltalkGlobals:parentSmalltalkGlobals},globals.HLManager)})},
+var $1;
+$1=_st($Environment())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultEnvironment",{},globals.HLManager)})},
 args: [],
-source: "defaultEnvironment\x0a\x09\x22If helios is loaded from within a frame, answer the parent window environment\x22\x0a\x09\x0a\x09| parent parentSmalltalkGlobals |\x0a\x09\x0a\x09parent := window opener ifNil: [ window parent ].\x0a\x09parent ifNil: [ ^ Environment new ].\x0a\x09\x0a\x09[ parentSmalltalkGlobals := ((parent at: 'requirejs') value: 'amber/boot') at: 'globals' ]\x0a\x09on: Error do: [ parentSmalltalkGlobals := (parent at: 'requirejs') value: 'amber_vm/globals' ].\x0a\x09parentSmalltalkGlobals ifNil: [ ^ Environment new ].\x0a\x09\x0a\x09^ (parentSmalltalkGlobals at: 'Environment') new",
-messageSends: ["ifNil:", "opener", "parent", "new", "on:do:", "at:", "value:"],
-referencedClasses: ["Environment", "Error"]
+source: "defaultEnvironment\x0a\x09\x22If helios is loaded from within a frame, answer the parent window environment\x22\x0a\x09\x0a\x09 ^ Environment new",
+messageSends: ["new"],
+referencedClasses: ["Environment"]
 }),
 globals.HLManager);
 

+ 1 - 10
support/helios/src/Helios-Core.st

@@ -1312,16 +1312,7 @@ request: aString value: valueString do: aBlock
 defaultEnvironment
 	"If helios is loaded from within a frame, answer the parent window environment"
 	
-	| parent parentSmalltalkGlobals |
-	
-	parent := window opener ifNil: [ window parent ].
-	parent ifNil: [ ^ Environment new ].
-	
-	[ parentSmalltalkGlobals := ((parent at: 'requirejs') value: 'amber/boot') at: 'globals' ]
-	on: Error do: [ parentSmalltalkGlobals := (parent at: 'requirejs') value: 'amber_vm/globals' ].
-	parentSmalltalkGlobals ifNil: [ ^ Environment new ].
-	
-	^ (parentSmalltalkGlobals at: 'Environment') new
+	 ^ Environment new
 ! !
 
 !HLManager methodsFor: 'initialization'!

+ 1 - 1
support/helpers.js

@@ -34,7 +34,7 @@ define("amber/helpers", ["amber/boot", "require"], function (boot, require) {
     }
 
     function settingsInLocalStorage() {
-        var global = new Function('return this')(),
+        var global = window,
             storage = 'localStorage' in global && global.localStorage;
 
         if (storage) {