@dualbox/editor 1.0.42 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103979,11 +103979,13 @@ class DualboxEditor {
103979
103979
  throw "Failed to load script " + pkg.name;
103980
103980
  });
103981
103981
 
103982
+ /*
103982
103983
  var timeout = setTimeout(function () {
103983
103984
  cb("Failed to load " + pkg.name + " after 5 seconds");
103984
103985
  }, 5000);
103986
+ */
103985
103987
  script[0].addEventListener("load", () => {
103986
- clearTimeout(timeout);
103988
+ //clearTimeout(timeout);
103987
103989
  cb();
103988
103990
  });
103989
103991
  }
@@ -104025,16 +104027,6 @@ class DualboxEditor {
104025
104027
  return require(name); // TODO: local only for now
104026
104028
  };
104027
104029
 
104028
- // Safety when the user leave the page,
104029
- // if not already defined externally
104030
- if (!window.onbeforeunload) {
104031
- window.onbeforeunload = function () {
104032
- return "Unsaved changes will be lost, are you sure you want to leave the editor?";
104033
- };
104034
- }
104035
-
104036
- this.loadCorePackages();
104037
-
104038
104030
  // if defined, call progress callback when needed
104039
104031
  // signature: onLoadProgress(stepName, percentage);
104040
104032
  this.onLoadProgress = attrs.onLoadProgress || function (stepName, numberDone, numberTotal) {
@@ -104045,13 +104037,17 @@ class DualboxEditor {
104045
104037
  }
104046
104038
  };
104047
104039
 
104048
- if (attrs.json) {
104049
- this.onLoadProgress((step, nbDone, nbTotal) => {
104050
- if (attrs.onLoadProgress) {
104051
- p.onLoadProgress(step, nbDone, nbTotal);
104052
- }
104053
- });
104040
+ // Safety when the user leave the page,
104041
+ // if not already defined externally
104042
+ if (!window.onbeforeunload) {
104043
+ window.onbeforeunload = function () {
104044
+ return "Unsaved changes will be lost, are you sure you want to leave the editor?";
104045
+ };
104046
+ }
104047
+
104048
+ this.loadCorePackages();
104054
104049
 
104050
+ if (attrs.json) {
104055
104051
  this.onReady(() => {
104056
104052
  var p = this.setApp(attrs.json);
104057
104053
  if (attrs.onLoaded) {
@@ -104069,12 +104065,14 @@ class DualboxEditor {
104069
104065
  async loadCorePackages() {
104070
104066
 
104071
104067
  var pkgName = "@dualbox/dualbox";
104068
+ this.onLoadProgress("Loading Dualbox");
104072
104069
  await this.loadPackage(pkgName);
104073
104070
  if (window.DualBox && window.DualBox.start) {
104074
104071
  this.DualBox = window.DualBox;
104075
104072
  } else {
104076
104073
  this.DualBox = window.DualBox = this.require(pkgName);
104077
104074
  }
104075
+
104078
104076
  lodash.each(this.DualBox.core, async corePackage => {
104079
104077
  await this.loadPackage(corePackage.name);
104080
104078
  });
@@ -150,11 +150,13 @@ class DualboxEditor {
150
150
  throw "Failed to load script " + pkg.name;
151
151
  });
152
152
 
153
+ /*
153
154
  var timeout = setTimeout(function () {
154
155
  cb("Failed to load " + pkg.name + " after 5 seconds");
155
156
  }, 5000);
157
+ */
156
158
  script[0].addEventListener("load", () => {
157
- clearTimeout(timeout);
159
+ //clearTimeout(timeout);
158
160
  cb();
159
161
  });
160
162
  }
@@ -196,16 +198,6 @@ class DualboxEditor {
196
198
  return require(name); // TODO: local only for now
197
199
  };
198
200
 
199
- // Safety when the user leave the page,
200
- // if not already defined externally
201
- if (!window.onbeforeunload) {
202
- window.onbeforeunload = function () {
203
- return "Unsaved changes will be lost, are you sure you want to leave the editor?";
204
- };
205
- }
206
-
207
- this.loadCorePackages();
208
-
209
201
  // if defined, call progress callback when needed
210
202
  // signature: onLoadProgress(stepName, percentage);
211
203
  this.onLoadProgress = attrs.onLoadProgress || function (stepName, numberDone, numberTotal) {
@@ -216,13 +208,17 @@ class DualboxEditor {
216
208
  }
217
209
  };
218
210
 
219
- if (attrs.json) {
220
- this.onLoadProgress((step, nbDone, nbTotal) => {
221
- if (attrs.onLoadProgress) {
222
- p.onLoadProgress(step, nbDone, nbTotal);
223
- }
224
- });
211
+ // Safety when the user leave the page,
212
+ // if not already defined externally
213
+ if (!window.onbeforeunload) {
214
+ window.onbeforeunload = function () {
215
+ return "Unsaved changes will be lost, are you sure you want to leave the editor?";
216
+ };
217
+ }
218
+
219
+ this.loadCorePackages();
225
220
 
221
+ if (attrs.json) {
226
222
  this.onReady(() => {
227
223
  var p = this.setApp(attrs.json);
228
224
  if (attrs.onLoaded) {
@@ -243,12 +239,14 @@ class DualboxEditor {
243
239
  };
244
240
 
245
241
  var pkgName = "@dualbox/dualbox";
242
+ this.onLoadProgress("Loading Dualbox");
246
243
  await this.loadPackage(pkgName);
247
244
  if (window.DualBox && window.DualBox.start) {
248
245
  this.DualBox = window.DualBox;
249
246
  } else {
250
247
  this.DualBox = window.DualBox = this.require(pkgName);
251
248
  }
249
+
252
250
  _.each(this.DualBox.core, async corePackage => {
253
251
  await this.loadPackage(corePackage.name);
254
252
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dualbox/editor",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "Editor of Dualbox apps",
5
5
  "browser": "js/dist/GraphEditor.js",
6
6
  "main": "js/dist/GraphEditor.js",