Browse Source

Move to use `globalThis`.

Herby Vojčík 2 months ago
parent
commit
017e724d7c
5 changed files with 16 additions and 6 deletions
  1. 10 0
      CHANGELOG
  2. 1 1
      index.html
  3. 1 1
      lang/base/boot.js
  4. 1 1
      lang/base/helpers.js
  5. 3 3
      lang/base/kernel-checks.js

+ 10 - 0
CHANGELOG

@@ -1,3 +1,13 @@
+23 Feb 2021 - Release 0.30.0
+===================================
+
+* Move to use `globalThis`.
+  * Stop using `global`, so breaking, but just fix preamble of index.html.
+* Removed old backward-compatibility code.
+
+Commits: https://lolg.it/amber/amber/commits/0.30.0
+
+
 18 Dec 2020 - Release 0.29.8
 ===================================
 

+ 1 - 1
index.html

@@ -23,7 +23,7 @@
 </div>
 <script type='text/javascript'>
     "use strict";
-    var global = typeof global === "undefined" ? window : global || window;
+    var globalThis = typeof globalThis === "undefined" ? window : globalThis || window;
     (function () {
         var startLegacy = document.getElementById("startlegacy");
         var startHelios = document.getElementById("starthelios");

+ 1 - 1
lang/base/boot.js

@@ -44,7 +44,7 @@ define([
 ], function (require, _, Brikz, FundamentalsFactory, LanguageFactory) {
     "use strict";
 
-    var globals = Object.create(global);
+    var globals = Object.create(globalThis);
     var emit = Object.create(null);
 
     var runtimeLoadedPromise = new Promise(function (resolve, reject) {

+ 1 - 1
lang/base/helpers.js

@@ -33,7 +33,7 @@ define(["./boot", "./junk-drawer", "require"], function (boot, $goodies, require
     function settingsInLocalStorage () {
         var storage;
         try {
-            storage = 'localStorage' in global && global.localStorage;
+            storage = 'localStorage' in globalThis && globalThis.localStorage;
         } catch (ex) {
             console.warn("Access denied to localStorage, " +
                 "settings not loaded nor, subsequently, saved.");

+ 3 - 3
lang/base/kernel-checks.js

@@ -36,13 +36,13 @@ define(function () {
     //     return Object.create(new Function("return this")()).Object === Object;
     // });
     assert(function () {
-        return typeof global !== "undefined";
+        return typeof globalThis !== "undefined";
     });
     assert(function () {
-        return global.Object === Object;
+        return globalThis.Object === Object;
     });
     assert(function () {
-        return Object.create(global).Object === Object;
+        return Object.create(globalThis).Object === Object;
     });
     assert(function () {
         return (function () {