@breakside/jskit 2022.4.0 → 2022.7.1
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.
- package/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSUserDefaults.js +28 -7
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/Docs/DocComponent.js +11 -0
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/DBMongoStore.js +1 -0
- package/Root/Frameworks/DBKit/DBRedisStore.js +138 -118
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSUserDefaults.js +28 -7
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/SKAMQPJobQueue.js +1 -1
- package/Root/Frameworks/ServerKit/SKApplication+Node.js +5 -3
- package/Root/Frameworks/ServerKit/SKHTTPServer.js +1 -1
- package/Root/Frameworks/ServerKit/SKJobQueue.js +1 -1
- package/Root/Frameworks/ServerKit/SKRedisJobQueue.js +7 -3
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UIHTMLApplication.js +21 -5
- package/Root/Frameworks/UIKit/UIScene.js +5 -1
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/Root/Templates/http/${PROJECT_NAME}/Dockerfile +1 -1
- package/Root/Templates/node/${PROJECT_NAME}/Dockerfile +4 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.7.1",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "DOM+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
6
|
-
"JSBundleVersion": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.7.1",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
11
11
|
"node": "DOM+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.7.1",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
8
8
|
"html": "FontKit+HTML.js"
|
|
9
9
|
},
|
|
10
10
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.JSKit.FontKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
6
|
-
"JSBundleVersion": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.7.1",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
10
10
|
"html": "FontKit+HTML.js"
|
|
11
11
|
},
|
|
12
12
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [],
|
|
16
16
|
"ResourceLookup": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.7.1",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "Foundation+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
13
13
|
}
|
|
@@ -29,12 +29,17 @@ var logger = JSLog("foundation", "user-defaults");
|
|
|
29
29
|
JSClass("JSUserDefaults", JSObject, {
|
|
30
30
|
|
|
31
31
|
identifier: JSReadOnlyProperty('_identifier', null),
|
|
32
|
+
_fileManager: null,
|
|
32
33
|
_defaults: null,
|
|
33
34
|
_values: null,
|
|
34
35
|
|
|
35
|
-
initWithIdentifier: function(identifier){
|
|
36
|
+
initWithIdentifier: function(identifier, fileManager){
|
|
37
|
+
if (fileManager === undefined){
|
|
38
|
+
fileManager = JSFileManager.shared;
|
|
39
|
+
}
|
|
40
|
+
this._fileManager = fileManager;
|
|
36
41
|
this._identifier = identifier;
|
|
37
|
-
this._url =
|
|
42
|
+
this._url = this._fileManager.persistentContainerURL.appendingPathComponents(['Preferences', '%s.prefs.json'.sprintf(this._identifier)]);
|
|
38
43
|
this._defaults = {};
|
|
39
44
|
},
|
|
40
45
|
|
|
@@ -42,7 +47,7 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
42
47
|
if (!completion){
|
|
43
48
|
completion = Promise.completion(Promise.resolveTrue);
|
|
44
49
|
}
|
|
45
|
-
|
|
50
|
+
this._fileManager.contentsAtURL(this._url, function JSUserDefaults_open_contents(data){
|
|
46
51
|
try{
|
|
47
52
|
if (data !== null){
|
|
48
53
|
var json = String.initWithData(data, String.Encoding.utf8);
|
|
@@ -60,6 +65,19 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
60
65
|
},
|
|
61
66
|
|
|
62
67
|
close: function(completion, target){
|
|
68
|
+
if (!completion){
|
|
69
|
+
completion = Promise.completion(Promise.resolveTrue);
|
|
70
|
+
}
|
|
71
|
+
this.synchronize(function(success){
|
|
72
|
+
if (success){
|
|
73
|
+
this._values = null;
|
|
74
|
+
}
|
|
75
|
+
completion.call(target, success);
|
|
76
|
+
}, this);
|
|
77
|
+
return completion.promise;
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
synchronize: function(completion, target){
|
|
63
81
|
if (!completion){
|
|
64
82
|
completion = Promise.completion(Promise.resolveTrue);
|
|
65
83
|
}
|
|
@@ -75,9 +93,6 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
75
93
|
}
|
|
76
94
|
if (needsSave){
|
|
77
95
|
this._persist(function JSUserDefaults_close_persisted(success){
|
|
78
|
-
if (success){
|
|
79
|
-
this._values = null;
|
|
80
|
-
}
|
|
81
96
|
completion.call(target, success);
|
|
82
97
|
}, this);
|
|
83
98
|
}else{
|
|
@@ -89,6 +104,9 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
89
104
|
// MARK: - Getting and Setting values
|
|
90
105
|
|
|
91
106
|
valueForKey: function(key){
|
|
107
|
+
if (this._values === null){
|
|
108
|
+
throw new Error("JSUserDefaults is closed, cannot get value. Be sure to call open() first.");
|
|
109
|
+
}
|
|
92
110
|
if (key in this._values){
|
|
93
111
|
return this._values[key];
|
|
94
112
|
}
|
|
@@ -99,6 +117,9 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
99
117
|
},
|
|
100
118
|
|
|
101
119
|
setValueForKey: function(value, key){
|
|
120
|
+
if (this._values === null){
|
|
121
|
+
throw new Error("JSUserDefaults is closed, cannot set value. Be sure to call open() first.");
|
|
122
|
+
}
|
|
102
123
|
this._values[key] = value;
|
|
103
124
|
this._persistAfterDelay();
|
|
104
125
|
this._definePropertyForKey(key);
|
|
@@ -161,7 +182,7 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
161
182
|
}else{
|
|
162
183
|
var data = JSON.stringify(this._values).utf8();
|
|
163
184
|
logger.info("saving user defaults");
|
|
164
|
-
|
|
185
|
+
this._fileManager.createFileAtURL(this._url, data, function JSUserDefaults_persist_createFile(success){
|
|
165
186
|
if (!success){
|
|
166
187
|
logger.error("failed to write user defaults");
|
|
167
188
|
}else{
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
6
|
-
"JSBundleVersion": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.7.1",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
11
11
|
"node": "Foundation+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [
|
|
17
17
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.7.1",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "SecurityKit+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
6
|
-
"JSBundleVersion": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.7.1",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
11
11
|
"node": "SecurityKit+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
package/Info.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "node",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.7.1",
|
|
5
5
|
"JSExecutableName": "jskit",
|
|
6
6
|
"NPMOrganization": "breakside",
|
|
7
7
|
"JSResources": [
|
|
8
8
|
"Tests/HTMLTestRunner.js",
|
|
9
9
|
"Tests/NodeTestRunner.js"
|
|
10
10
|
],
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
12
12
|
}
|
|
@@ -275,6 +275,16 @@ JSClass("DocComponent", JSObject, {
|
|
|
275
275
|
script = head.appendChild(document.createElement('script'));
|
|
276
276
|
script.appendChild(document.createTextNode(googleAnalyticsTemplate.replacingTemplateParameters({TRACKING_ID: page.googleAnalytics, PATH: path})));
|
|
277
277
|
}
|
|
278
|
+
if (page.telemetryKey){
|
|
279
|
+
let path = this.outputURL.removingFileExtension().encodedStringRelativeTo(documentation.wwwURL);
|
|
280
|
+
if (path == 'index'){
|
|
281
|
+
path = '/';
|
|
282
|
+
}else{
|
|
283
|
+
path = '/' + path;
|
|
284
|
+
}
|
|
285
|
+
let script = head.appendChild(document.createElement('script'));
|
|
286
|
+
script.appendChild(document.createTextNode(telemetryTemplate.replacingTemplateParameters({KEY: page.telemetryKey, PATH: path})));
|
|
287
|
+
}
|
|
278
288
|
var breadcrumb = this.jsonLdBreadcrumbList();
|
|
279
289
|
if (breadcrumb){
|
|
280
290
|
let script = head.appendChild(document.createElement("script"));
|
|
@@ -884,6 +894,7 @@ JSClass("DocComponent", JSObject, {
|
|
|
884
894
|
});
|
|
885
895
|
|
|
886
896
|
var googleAnalyticsTemplate = "window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', '{{TRACKING_ID}}', {page_path: '{{PATH}}'});";
|
|
897
|
+
var telemetryTemplate = "(function(w, d){ var key = '{{KEY}}'; var s = d.createElement('script'); s.async = true; s.src = 'https://api.telemetry.rocketlaunch.studio/client/telemetry.js'; s.setAttribute('data-key', key); var e = (d.currentScript || d.head.childNodes[d.head.childNodes.length - 1]); e.parentNode.insertBefore(s, e); w._telemetry = function(){ _telemetry.q.push(arguments); }; _telemetry.q = []; })(window, document); _telemetry('count', 'screen', '{{PATH}}');";
|
|
887
898
|
|
|
888
899
|
DocComponent.Environments = [{id: 'html', name: 'HTML'}, {id: 'node', name: 'Node'}];
|
|
889
900
|
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.jskit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "node",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
6
|
-
"JSBundleVersion": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.7.1",
|
|
7
7
|
"JSExecutableName": "jskit",
|
|
8
8
|
"NPMOrganization": "breakside",
|
|
9
9
|
"JSResources": [
|
|
10
10
|
"Tests/HTMLTestRunner.js",
|
|
11
11
|
"Tests/NodeTestRunner.js"
|
|
12
12
|
],
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "919dc35759b6d2f77d5b2a30a3ced724a5210423"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
|
@@ -40,6 +40,7 @@ JSClass("DBMongoStore", DBObjectStore, {
|
|
|
40
40
|
this.databaseName = url.pathComponents[1];
|
|
41
41
|
url = url.copy();
|
|
42
42
|
url.path = null;
|
|
43
|
+
url.query.set("retryWrites", "false");
|
|
43
44
|
this.tlsCertificateName = url.query.get("ssl_ca_certs", null);
|
|
44
45
|
if (this.tlsCertificateName !== null){
|
|
45
46
|
url.query.unset("ssl_ca_certs");
|
|
@@ -41,7 +41,7 @@ JSClass("DBRedisStore", DBObjectStore, {
|
|
|
41
41
|
|
|
42
42
|
open: function(completion){
|
|
43
43
|
logger.info("Redis client connecting to %{public}:%d...", this.url.host, this.url.port || 6379);
|
|
44
|
-
this.client = this.redis.createClient({url: this.url.encodedString});
|
|
44
|
+
this.client = this.redis.createClient({url: this.url.encodedString, legacyMode: true});
|
|
45
45
|
var store = this;
|
|
46
46
|
var errorHandler = function(error){
|
|
47
47
|
logger.info("Failed to open Redis connection: %{error}", error);
|
|
@@ -67,8 +67,12 @@ JSClass("DBRedisStore", DBObjectStore, {
|
|
|
67
67
|
store.close(fn);
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
this.client.
|
|
71
|
-
|
|
70
|
+
if (this.client.connect){
|
|
71
|
+
this.client.connect().then(readyHandler, errorHandler);
|
|
72
|
+
}else{
|
|
73
|
+
this.client.on("error", errorHandler);
|
|
74
|
+
this.client.on("ready", readyHandler);
|
|
75
|
+
}
|
|
72
76
|
},
|
|
73
77
|
|
|
74
78
|
closeCallback: null,
|
|
@@ -233,7 +237,7 @@ JSClass("DBRedisStore", DBObjectStore, {
|
|
|
233
237
|
|
|
234
238
|
watchClientQueue: null,
|
|
235
239
|
|
|
236
|
-
dequeueReusableWatchClient: function(){
|
|
240
|
+
dequeueReusableWatchClient: function(completion, target){
|
|
237
241
|
if (this.watchClientQueue === null){
|
|
238
242
|
this.watchClientQueue = [];
|
|
239
243
|
}
|
|
@@ -242,10 +246,21 @@ JSClass("DBRedisStore", DBObjectStore, {
|
|
|
242
246
|
this.cleanupWatchClientQueueTimer.invalidate();
|
|
243
247
|
this.cleanupWatchClientQueueTimer = null;
|
|
244
248
|
}
|
|
245
|
-
|
|
249
|
+
completion.call(target, this.watchClientQueue.shift());
|
|
250
|
+
return;
|
|
246
251
|
}
|
|
247
252
|
logger.info("opening watch client to %{public}:%d", this.url.host, this.url.port || 6379);
|
|
248
|
-
|
|
253
|
+
var client = this.redis.createClient({url: this.url.encodedString, legacyMode: true});
|
|
254
|
+
if (client.connect){
|
|
255
|
+
client.connect().then(function(){
|
|
256
|
+
completion.call(target, client);
|
|
257
|
+
}, function(error){
|
|
258
|
+
logger.error("Error connecting to watch client: %{error}", error);
|
|
259
|
+
completion.call(target, null);
|
|
260
|
+
});
|
|
261
|
+
}else{
|
|
262
|
+
completion.call(target, client);
|
|
263
|
+
}
|
|
249
264
|
},
|
|
250
265
|
|
|
251
266
|
enqueueReusableWatchClient: function(client){
|
|
@@ -277,120 +292,125 @@ JSClass("DBRedisStore", DBObjectStore, {
|
|
|
277
292
|
},
|
|
278
293
|
|
|
279
294
|
exclusiveSave: function(id, change, completion){
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
var waitInterval = JSTimeInterval.milliseconds(20);
|
|
283
|
-
var retires = 0;
|
|
284
|
-
var store = this;
|
|
285
|
-
var trySave = function(){
|
|
286
|
-
try{
|
|
287
|
-
watchClient.watch(id, function(error){
|
|
288
|
-
if (error !== null){
|
|
289
|
-
logger.error("Failure calling redis watch: %{error}", error);
|
|
290
|
-
watchClient.quit();
|
|
291
|
-
completion(false);
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
try{
|
|
295
|
-
watchClient.get(id, function(error, json){
|
|
296
|
-
if (error !== null){
|
|
297
|
-
logger.error("Failure calling redis get: %{error}", error);
|
|
298
|
-
watchClient.quit();
|
|
299
|
-
completion(false);
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
var object = null;
|
|
303
|
-
try{
|
|
304
|
-
object = JSON.parse(json);
|
|
305
|
-
}catch (e){
|
|
306
|
-
logger.error("Failure parsing object json: %{error}", error);
|
|
307
|
-
watchClient.quit();
|
|
308
|
-
completion(false);
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
try{
|
|
312
|
-
watchClient.ttl(id, function(error, ttl){
|
|
313
|
-
if (error !== null){
|
|
314
|
-
logger.error("Failure calling redis ttl: %{error}", error);
|
|
315
|
-
watchClient.quit();
|
|
316
|
-
completion(false);
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
try{
|
|
320
|
-
change(object, function(changedObject){
|
|
321
|
-
if (changedObject === null){
|
|
322
|
-
watchClient.quit();
|
|
323
|
-
completion(false);
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
var changedJSON = null;
|
|
327
|
-
try{
|
|
328
|
-
changedJSON = JSON.stringify(changedObject);
|
|
329
|
-
}catch (e){
|
|
330
|
-
logger.error("Failed to serialize object for redis: %{error}", e);
|
|
331
|
-
watchClient.quit();
|
|
332
|
-
completion(false);
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
var args = [id, changedJSON];
|
|
336
|
-
if (ttl > 0){
|
|
337
|
-
args.push("EX");
|
|
338
|
-
args.push(ttl);
|
|
339
|
-
}
|
|
340
|
-
try{
|
|
341
|
-
watchClient.multi().set(args).exec(function(error, results){
|
|
342
|
-
if (error !== null){
|
|
343
|
-
logger.error("Failure calling redis multi/set/exec: %{error}", error);
|
|
344
|
-
watchClient.quit();
|
|
345
|
-
completion(false);
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
if (results === null){
|
|
349
|
-
// null results means the transaction failed, so it's our signal to retry
|
|
350
|
-
++retires;
|
|
351
|
-
if (retires > maxRetires){
|
|
352
|
-
store.enqueueReusableWatchClient(watchClient);
|
|
353
|
-
completion(true);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
JSTimer.scheduledTimerWithInterval(waitInterval, trySave);
|
|
357
|
-
waitInterval = Math.min(1, waitInterval * 2);
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
store.enqueueReusableWatchClient(watchClient);
|
|
361
|
-
completion(true);
|
|
362
|
-
});
|
|
363
|
-
}catch (e){
|
|
364
|
-
logger.error("Error thrown calling redis multi/set/exec: %{error}", e);
|
|
365
|
-
watchClient.quit();
|
|
366
|
-
completion(false);
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
}catch (e){
|
|
370
|
-
logger.error("Error thrown calling change function: %{error}", e);
|
|
371
|
-
watchClient.quit();
|
|
372
|
-
completion(false);
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
}catch (e){
|
|
376
|
-
logger.error("Error thrown calling redis ttl: %{error}", error);
|
|
377
|
-
watchClient.quit();
|
|
378
|
-
completion(false);
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
}catch (e){
|
|
382
|
-
logger.error("Error thrown calling redis get: %{error}", error);
|
|
383
|
-
watchClient.quit();
|
|
384
|
-
completion(false);
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
}catch (e){
|
|
388
|
-
logger.error("Error thrown calling redis watch: %{error}", e);
|
|
389
|
-
watchClient.quit();
|
|
295
|
+
this.dequeueReusableWatchClient(function(watchClient){
|
|
296
|
+
if (watchClient === null){
|
|
390
297
|
completion(false);
|
|
298
|
+
return;
|
|
391
299
|
}
|
|
392
|
-
|
|
393
|
-
|
|
300
|
+
var maxRetires = 30;
|
|
301
|
+
var waitInterval = JSTimeInterval.milliseconds(20);
|
|
302
|
+
var retires = 0;
|
|
303
|
+
var store = this;
|
|
304
|
+
var trySave = function(){
|
|
305
|
+
try{
|
|
306
|
+
watchClient.watch(id, function(error){
|
|
307
|
+
if (error !== null){
|
|
308
|
+
logger.error("Failure calling redis watch: %{error}", error);
|
|
309
|
+
watchClient.quit();
|
|
310
|
+
completion(false);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
try{
|
|
314
|
+
watchClient.get(id, function(error, json){
|
|
315
|
+
if (error !== null){
|
|
316
|
+
logger.error("Failure calling redis get: %{error}", error);
|
|
317
|
+
watchClient.quit();
|
|
318
|
+
completion(false);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
var object = null;
|
|
322
|
+
try{
|
|
323
|
+
object = JSON.parse(json);
|
|
324
|
+
}catch (e){
|
|
325
|
+
logger.error("Failure parsing object json: %{error}", error);
|
|
326
|
+
watchClient.quit();
|
|
327
|
+
completion(false);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
try{
|
|
331
|
+
watchClient.ttl(id, function(error, ttl){
|
|
332
|
+
if (error !== null){
|
|
333
|
+
logger.error("Failure calling redis ttl: %{error}", error);
|
|
334
|
+
watchClient.quit();
|
|
335
|
+
completion(false);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
try{
|
|
339
|
+
change(object, function(changedObject){
|
|
340
|
+
if (changedObject === null){
|
|
341
|
+
watchClient.quit();
|
|
342
|
+
completion(false);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
var changedJSON = null;
|
|
346
|
+
try{
|
|
347
|
+
changedJSON = JSON.stringify(changedObject);
|
|
348
|
+
}catch (e){
|
|
349
|
+
logger.error("Failed to serialize object for redis: %{error}", e);
|
|
350
|
+
watchClient.quit();
|
|
351
|
+
completion(false);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
var args = [id, changedJSON];
|
|
355
|
+
if (ttl > 0){
|
|
356
|
+
args.push("EX");
|
|
357
|
+
args.push(ttl);
|
|
358
|
+
}
|
|
359
|
+
try{
|
|
360
|
+
watchClient.multi().set(args).exec(function(error, results){
|
|
361
|
+
if (error !== null){
|
|
362
|
+
logger.error("Failure calling redis multi/set/exec: %{error}", error);
|
|
363
|
+
watchClient.quit();
|
|
364
|
+
completion(false);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (results === null){
|
|
368
|
+
// null results means the transaction failed, so it's our signal to retry
|
|
369
|
+
++retires;
|
|
370
|
+
if (retires > maxRetires){
|
|
371
|
+
store.enqueueReusableWatchClient(watchClient);
|
|
372
|
+
completion(true);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
JSTimer.scheduledTimerWithInterval(waitInterval, trySave);
|
|
376
|
+
waitInterval = Math.min(1, waitInterval * 2);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
store.enqueueReusableWatchClient(watchClient);
|
|
380
|
+
completion(true);
|
|
381
|
+
});
|
|
382
|
+
}catch (e){
|
|
383
|
+
logger.error("Error thrown calling redis multi/set/exec: %{error}", e);
|
|
384
|
+
watchClient.quit();
|
|
385
|
+
completion(false);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}catch (e){
|
|
389
|
+
logger.error("Error thrown calling change function: %{error}", e);
|
|
390
|
+
watchClient.quit();
|
|
391
|
+
completion(false);
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}catch (e){
|
|
395
|
+
logger.error("Error thrown calling redis ttl: %{error}", error);
|
|
396
|
+
watchClient.quit();
|
|
397
|
+
completion(false);
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}catch (e){
|
|
401
|
+
logger.error("Error thrown calling redis get: %{error}", error);
|
|
402
|
+
watchClient.quit();
|
|
403
|
+
completion(false);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}catch (e){
|
|
407
|
+
logger.error("Error thrown calling redis watch: %{error}", e);
|
|
408
|
+
watchClient.quit();
|
|
409
|
+
completion(false);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
trySave();
|
|
413
|
+
}, this);
|
|
394
414
|
},
|
|
395
415
|
|
|
396
416
|
saveChange: function(change, completion){
|
|
@@ -29,12 +29,17 @@ var logger = JSLog("foundation", "user-defaults");
|
|
|
29
29
|
JSClass("JSUserDefaults", JSObject, {
|
|
30
30
|
|
|
31
31
|
identifier: JSReadOnlyProperty('_identifier', null),
|
|
32
|
+
_fileManager: null,
|
|
32
33
|
_defaults: null,
|
|
33
34
|
_values: null,
|
|
34
35
|
|
|
35
|
-
initWithIdentifier: function(identifier){
|
|
36
|
+
initWithIdentifier: function(identifier, fileManager){
|
|
37
|
+
if (fileManager === undefined){
|
|
38
|
+
fileManager = JSFileManager.shared;
|
|
39
|
+
}
|
|
40
|
+
this._fileManager = fileManager;
|
|
36
41
|
this._identifier = identifier;
|
|
37
|
-
this._url =
|
|
42
|
+
this._url = this._fileManager.persistentContainerURL.appendingPathComponents(['Preferences', '%s.prefs.json'.sprintf(this._identifier)]);
|
|
38
43
|
this._defaults = {};
|
|
39
44
|
},
|
|
40
45
|
|
|
@@ -42,7 +47,7 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
42
47
|
if (!completion){
|
|
43
48
|
completion = Promise.completion(Promise.resolveTrue);
|
|
44
49
|
}
|
|
45
|
-
|
|
50
|
+
this._fileManager.contentsAtURL(this._url, function JSUserDefaults_open_contents(data){
|
|
46
51
|
try{
|
|
47
52
|
if (data !== null){
|
|
48
53
|
var json = String.initWithData(data, String.Encoding.utf8);
|
|
@@ -60,6 +65,19 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
60
65
|
},
|
|
61
66
|
|
|
62
67
|
close: function(completion, target){
|
|
68
|
+
if (!completion){
|
|
69
|
+
completion = Promise.completion(Promise.resolveTrue);
|
|
70
|
+
}
|
|
71
|
+
this.synchronize(function(success){
|
|
72
|
+
if (success){
|
|
73
|
+
this._values = null;
|
|
74
|
+
}
|
|
75
|
+
completion.call(target, success);
|
|
76
|
+
}, this);
|
|
77
|
+
return completion.promise;
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
synchronize: function(completion, target){
|
|
63
81
|
if (!completion){
|
|
64
82
|
completion = Promise.completion(Promise.resolveTrue);
|
|
65
83
|
}
|
|
@@ -75,9 +93,6 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
75
93
|
}
|
|
76
94
|
if (needsSave){
|
|
77
95
|
this._persist(function JSUserDefaults_close_persisted(success){
|
|
78
|
-
if (success){
|
|
79
|
-
this._values = null;
|
|
80
|
-
}
|
|
81
96
|
completion.call(target, success);
|
|
82
97
|
}, this);
|
|
83
98
|
}else{
|
|
@@ -89,6 +104,9 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
89
104
|
// MARK: - Getting and Setting values
|
|
90
105
|
|
|
91
106
|
valueForKey: function(key){
|
|
107
|
+
if (this._values === null){
|
|
108
|
+
throw new Error("JSUserDefaults is closed, cannot get value. Be sure to call open() first.");
|
|
109
|
+
}
|
|
92
110
|
if (key in this._values){
|
|
93
111
|
return this._values[key];
|
|
94
112
|
}
|
|
@@ -99,6 +117,9 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
99
117
|
},
|
|
100
118
|
|
|
101
119
|
setValueForKey: function(value, key){
|
|
120
|
+
if (this._values === null){
|
|
121
|
+
throw new Error("JSUserDefaults is closed, cannot set value. Be sure to call open() first.");
|
|
122
|
+
}
|
|
102
123
|
this._values[key] = value;
|
|
103
124
|
this._persistAfterDelay();
|
|
104
125
|
this._definePropertyForKey(key);
|
|
@@ -161,7 +182,7 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
161
182
|
}else{
|
|
162
183
|
var data = JSON.stringify(this._values).utf8();
|
|
163
184
|
logger.info("saving user defaults");
|
|
164
|
-
|
|
185
|
+
this._fileManager.createFileAtURL(this._url, data, function JSUserDefaults_persist_createFile(success){
|
|
165
186
|
if (!success){
|
|
166
187
|
logger.error("failed to write user defaults");
|
|
167
188
|
}else{
|
|
@@ -151,7 +151,7 @@ JSClass("SKAMQPJobQueue", SKJobQueue, {
|
|
|
151
151
|
|
|
152
152
|
enqueueDictionary: async function(dictionary){
|
|
153
153
|
var json = JSON.stringify(dictionary);
|
|
154
|
-
var content = json.utf8();
|
|
154
|
+
var content = json.utf8().nodeBuffer();
|
|
155
155
|
await this.channel.sendToQueue(this.identifier, content, {persistent: true, priority: dictionary.priority});
|
|
156
156
|
},
|
|
157
157
|
|
|
@@ -54,18 +54,20 @@ SKApplication.definePropertiesFromExtensions({
|
|
|
54
54
|
var logs = JSLog.getRecords();
|
|
55
55
|
var promise = this.delegate.applicationDidCrash(this, error, logs);
|
|
56
56
|
if (promise instanceof Promise){
|
|
57
|
-
promise.catch(function(
|
|
58
|
-
logger.error("
|
|
57
|
+
promise.catch(function(e){
|
|
58
|
+
logger.error("SKApplication crash: %{error}", error);
|
|
59
|
+
logger.error("Error while handling crash: %{error}", e);
|
|
59
60
|
}).finally(stop);
|
|
60
61
|
}else{
|
|
61
62
|
stop();
|
|
62
63
|
}
|
|
63
64
|
}catch (e){
|
|
65
|
+
logger.error("SKApplication crash: %{error}", error);
|
|
64
66
|
logger.error("Error while handling crash: %{error}", e);
|
|
65
67
|
stop();
|
|
66
68
|
}
|
|
67
69
|
}else{
|
|
68
|
-
logger.error(error);
|
|
70
|
+
logger.error("SKApplication crash: %{error}", error);
|
|
69
71
|
stop();
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -148,7 +148,7 @@ JSClass("SKHTTPServer", JSObject, {
|
|
|
148
148
|
if (this.delegate && this.delegate.serverRouteNotFoundForRequest){
|
|
149
149
|
this.delegate.serverRouteNotFoundForRequest(this, request);
|
|
150
150
|
}
|
|
151
|
-
request.logger.
|
|
151
|
+
request.logger.info("%{public} %{public} No route for request", request.method, request.url.path);
|
|
152
152
|
throw new SKHTTPError(SKHTTPResponse.StatusCode.notFound);
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -35,7 +35,7 @@ JSClass("SKJobQueue", JSObject, {
|
|
|
35
35
|
return SKFileJobQueue.initWithURL(url, fileManager);
|
|
36
36
|
}else if (url.scheme === "redis"){
|
|
37
37
|
return SKRedisJobQueue.initWithURL(url, service);
|
|
38
|
-
}else if (url.scheme === "amqp"){
|
|
38
|
+
}else if (url.scheme === "amqp" || url.scheme === "amqps"){
|
|
39
39
|
return SKAMQPJobQueue.initWithURL(url, service);
|
|
40
40
|
}else if (url.scheme === "memory"){
|
|
41
41
|
return SKMemoryJobQueue.init();
|
|
@@ -46,7 +46,7 @@ JSClass("SKRedisJobQueue", SKJobQueue, {
|
|
|
46
46
|
if (this.openPromise === null){
|
|
47
47
|
this.openPromise = new Promise(function(resolve, reject){
|
|
48
48
|
logger.info("Redis client connecting to %{public}:%d...", queue.url.host, queue.url.port || 6379);
|
|
49
|
-
var client = queue.redis.createClient({url: queue.url.encodedString});
|
|
49
|
+
var client = queue.redis.createClient({url: queue.url.encodedString, legacyMode: true});
|
|
50
50
|
var errorHandler = function(error){
|
|
51
51
|
logger.info("Failed to open Redis connection: %{error}", error);
|
|
52
52
|
queue.openPromise = null;
|
|
@@ -61,8 +61,12 @@ JSClass("SKRedisJobQueue", SKJobQueue, {
|
|
|
61
61
|
queue.client = client;
|
|
62
62
|
resolve();
|
|
63
63
|
};
|
|
64
|
-
client.
|
|
65
|
-
|
|
64
|
+
if (client.connect){
|
|
65
|
+
client.connect().then(readyHandler, errorHandler);
|
|
66
|
+
}else{
|
|
67
|
+
client.on("error", errorHandler);
|
|
68
|
+
client.on("ready", readyHandler);
|
|
69
|
+
}
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
72
|
return this.openPromise;
|
|
@@ -190,7 +190,27 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
190
190
|
},
|
|
191
191
|
|
|
192
192
|
_crash: function(error){
|
|
193
|
-
|
|
193
|
+
if (this.delegate && this.delegate.applicationDidCrash){
|
|
194
|
+
try{
|
|
195
|
+
var logs = JSLog.getRecords();
|
|
196
|
+
var promise = this.delegate.applicationDidCrash(this, error, logs);
|
|
197
|
+
if (promise instanceof Promise){
|
|
198
|
+
promise.catch(function(e){
|
|
199
|
+
logger.error("UIApplication crash: %{error}", error);
|
|
200
|
+
logger.error("Error while handling crash: %{error}", e);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}catch (e){
|
|
204
|
+
logger.error("UIApplication crash: %{error}", error);
|
|
205
|
+
logger.error("Error while handling crash: %{error}", e);
|
|
206
|
+
}
|
|
207
|
+
}else{
|
|
208
|
+
logger.error("UIApplication crash: %{error}", error);
|
|
209
|
+
}
|
|
210
|
+
this._showCrashScreen();
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
_showCrashScreen: function(){
|
|
194
214
|
this.windowServer.stop();
|
|
195
215
|
var root = this.windowServer.displayServer.rootElement;
|
|
196
216
|
var cover = root.appendChild(root.ownerDocument.createElement('div'));
|
|
@@ -201,10 +221,6 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
201
221
|
cover.style.right = '0';
|
|
202
222
|
cover.style.bottom = '0';
|
|
203
223
|
var message;
|
|
204
|
-
if (this.delegate && this.delegate.applicationDidCrash){
|
|
205
|
-
var logs = JSLog.getRecords();
|
|
206
|
-
message = this.delegate.applicationDidCrash(this, error, logs);
|
|
207
|
-
}
|
|
208
224
|
if (!message){
|
|
209
225
|
message = "Sorry, there was a problem and the application needs to restart.\n\nPlease reload the page to continue.";
|
|
210
226
|
}
|
|
@@ -56,6 +56,10 @@ JSClass("UIScene", JSObject, {
|
|
|
56
56
|
},
|
|
57
57
|
|
|
58
58
|
show: function(){
|
|
59
|
+
if (UIScene._visible !== null){
|
|
60
|
+
UIScene._visible.close();
|
|
61
|
+
}
|
|
62
|
+
UIScene._visible = this;
|
|
59
63
|
if (this.menuBar){
|
|
60
64
|
this.application.windowServer.menuBar = this.menuBar;
|
|
61
65
|
}
|
|
@@ -67,7 +71,6 @@ JSClass("UIScene", JSObject, {
|
|
|
67
71
|
if (window !== null){
|
|
68
72
|
window.makeKey();
|
|
69
73
|
}
|
|
70
|
-
UIScene._visible = this;
|
|
71
74
|
},
|
|
72
75
|
|
|
73
76
|
close: function(){
|
|
@@ -80,6 +83,7 @@ JSClass("UIScene", JSObject, {
|
|
|
80
83
|
window = windowServer.windowStack[i];
|
|
81
84
|
window.close();
|
|
82
85
|
}
|
|
86
|
+
UIScene._visible = null;
|
|
83
87
|
},
|
|
84
88
|
|
|
85
89
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
FROM node:lts-alpine
|
|
2
2
|
|
|
3
|
-
COPY ${PROJECT_NAME_FILE_SAFE}
|
|
3
|
+
COPY ${PROJECT_NAME_FILE_SAFE} /${PROJECT_NAME_FILE_SAFE}
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
RUN cd /${PROJECT_NAME_FILE_SAFE} && npm install
|
|
6
|
+
|
|
7
|
+
ENTRYPOINT ["/${PROJECT_NAME_FILE_SAFE}/Node/${PROJECT_NAME_FILE_SAFE}"]
|