@glassly/crust 0.4.4-beta.1330 → 0.4.4-beta.1364

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.
@@ -66,6 +66,9 @@ private struct PhotoLibrarySaveResult {
66
66
 
67
67
  public class CrustModule: Module {
68
68
  private var protectedDataObservers: [NSObjectProtocol] = []
69
+ private static let jsRuntimeQueue = DispatchQueue(
70
+ label: "com.tetramo.glassly.jsruntime.host-calls", qos: .userInitiated
71
+ )
69
72
 
70
73
  /// Phone lock state as seen by the app. Protected data (complete-protection
71
74
  /// files) is only readable/writable while the phone is unlocked, which makes
@@ -405,7 +408,7 @@ public class CrustModule: Module {
405
408
  polyfillBundle: polyfillBundle,
406
409
  miniappJs: miniappJs
407
410
  )
408
- }
411
+ }.runOnQueue(Self.jsRuntimeQueue)
409
412
 
410
413
  /// Evaluate an arbitrary script inside the named context. Returns
411
414
  /// the JS return value bridged to a JSON-friendly Swift type, or
@@ -413,19 +416,19 @@ public class CrustModule: Module {
413
416
  /// + tests; production code paths use jsDispatchToJs.
414
417
  AsyncFunction("jsEvaluate") { (packageName: String, source: String) -> Any? in
415
418
  return JSCRuntime.shared.evaluate(packageName: packageName, source: source)
416
- }
419
+ }.runOnQueue(Self.jsRuntimeQueue)
417
420
 
418
421
  /// Tear down a JS context. Cancels timers, drops refs, forces GC.
419
422
  AsyncFunction("jsKill") { (packageName: String) -> Void in
420
423
  JSCRuntime.shared.kill(packageName: packageName)
421
- }
424
+ }.runOnQueue(Self.jsRuntimeQueue)
422
425
 
423
426
  /// Push an event / response envelope into the named context's
424
427
  /// globalThis.__deliver. Used by JSRouter for
425
428
  /// glasses-status broadcasts and request/response correlation.
426
429
  AsyncFunction("jsDispatchToJs") { (packageName: String, envelope: [String: Any]) -> Void in
427
430
  JSCRuntime.shared.dispatchToJs(packageName: packageName, envelope: envelope)
428
- }
431
+ }.runOnQueue(Self.jsRuntimeQueue)
429
432
 
430
433
  /// Set the installed manifest for a miniapp so the dispatcher's
431
434
  /// permission gate can authorize sensitive `__dispatch` calls.
@@ -434,7 +437,7 @@ public class CrustModule: Module {
434
437
  packageName: packageName,
435
438
  manifest: InstalledMiniappManifest(permissions: Set(permissions))
436
439
  )
437
- }
440
+ }.runOnQueue(Self.jsRuntimeQueue)
438
441
 
439
442
  /// Diagnostic: list all live packageNames.
440
443
  Function("jsAlivePackages") { () -> [String] in
@@ -446,7 +449,7 @@ public class CrustModule: Module {
446
449
  /// the context is dead.
447
450
  AsyncFunction("jsDebugForceGC") { (packageName: String) -> Bool in
448
451
  return JSCRuntime.shared.debugForceGC(packageName: packageName)
449
- }
452
+ }.runOnQueue(Self.jsRuntimeQueue)
450
453
 
451
454
  /// Read the bundled JSRuntime polyfill (startup.js) from the iOS
452
455
  /// pod's resource bundle. The host calls this once on app boot,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/crust",
3
- "version": "0.4.4-beta.1330",
3
+ "version": "0.4.4-beta.1364",
4
4
  "description": "Glassly Native Module",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "license": "MIT",
35
35
  "homepage": "https://github.com/fossephate/crust#readme",
36
36
  "dependencies": {
37
- "@glassly/jspolyfill": "0.4.4-beta.1330"
37
+ "@glassly/jspolyfill": "0.4.4-beta.1364"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@expo/config-plugins": ">=8.0.0",