@breakside/jskit 2022.6.0 → 2022.6.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.
Files changed (40) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  5. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  6. package/Frameworks/Foundation.jsframework/JS/JSUserDefaults.js +28 -7
  7. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  8. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  9. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  10. package/Info.json +2 -2
  11. package/Node/io.breakside.jskit-bundle.js +2 -2
  12. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  13. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  14. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  15. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  16. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  17. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  18. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  19. package/Root/Frameworks/DOM/Info.yaml +1 -1
  20. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  21. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  22. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  23. package/Root/Frameworks/Foundation/JSUserDefaults.js +28 -7
  24. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  25. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  26. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  27. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  28. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  29. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  30. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  31. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  32. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  33. package/Root/Frameworks/ServerKit/SKAMQPJobQueue.js +1 -1
  34. package/Root/Frameworks/ServerKit/SKApplication+Node.js +5 -3
  35. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  36. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  37. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  38. package/Root/Frameworks/UIKit/UIHTMLApplication.js +21 -5
  39. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  40. 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.6.0",
4
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
12
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
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.0",
6
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
14
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
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.6.0",
4
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
11
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
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.0",
6
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
13
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
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.6.0",
4
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
12
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
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 = JSFileManager.shared.persistentContainerURL.appendingPathComponents(['Preferences', '%s.prefs.json'.sprintf(this._identifier)]);
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
- JSFileManager.shared.contentsAtURL(this._url, function JSUserDefaults_open_contents(data){
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
- JSFileManager.shared.createFileAtURL(this._url, data, function JSUserDefaults_persist_createFile(success){
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.0",
6
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
14
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
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.6.0",
4
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
12
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
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.0",
6
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
14
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
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.6.0",
4
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
11
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
12
12
  }
@@ -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.0",
6
+ "JSBundleVersion": "2022.6.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": "de032a1e1f2485f8f63b4989d038b7bcaf240314"
13
+ "GitRevision": "a2f98fcf4d3885174dec129a75926bd9e3925006"
14
14
  },
15
15
  "Resources": [
16
16
  {
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSIncludeDirectories:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKitTesting
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.AuthKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.CSSOM
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ChartKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2021 Breakside Inc.
6
6
  # JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ConferenceKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.DBKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.DOM
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.Dispatch
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSCopyright: Copyright © 2020 Breakside Inc.
5
5
  JSBundleEnvironments:
6
6
  html: Dispatch+HTML.js
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.FontKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.Foundation
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -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 = JSFileManager.shared.persistentContainerURL.appendingPathComponents(['Preferences', '%s.prefs.json'.sprintf(this._identifier)]);
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
- JSFileManager.shared.contentsAtURL(this._url, function JSUserDefaults_open_contents(data){
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
- JSFileManager.shared.createFileAtURL(this._url, data, function JSUserDefaults_persist_createFile(success){
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{
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ImageKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.MediaKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.MediaKitUI
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.NotificationKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2021 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.PDFKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.QRKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.SearchKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.SecurityKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ServerKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -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(error){
58
- logger.error("Error while handling crash: %{error}", 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
  }
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ServerKitTesting
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.TestKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKit
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -190,7 +190,27 @@ JSClass("UIHTMLApplication", UIApplication, {
190
190
  },
191
191
 
192
192
  _crash: function(error){
193
- logger.error(error);
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
  }
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2022.6.0
3
+ JSBundleVersion: 2022.6.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=10.10.0"
10
10
  },
11
11
  "name": "@breakside/jskit",
12
- "version": "2022.6.0",
12
+ "version": "2022.6.1",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"