cpp.js 1.0.2 → 1.0.4

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/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # cpp.js
2
2
 
3
- ## 1.0.2
3
+ ## 1.0.4
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - fix: workaround for race condition with turbomodule in android. In the future, it will be completely resolved by removing support for the old architecture.
7
+ - fix: workaround for race condition with turbomodule in android.
8
8
 
9
9
  ## 1.0.1
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cpp.js",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "license": "MIT",
5
5
  "homepage": "https://cpp.js.org",
6
6
  "repository": "https://github.com/bugra9/cpp.js.git",
@@ -36,7 +36,7 @@ export default function getCppJsScript(platform, bridgePath = null) {
36
36
 
37
37
  function getReactNativeScript(env, modulePrefix) {
38
38
  return `
39
- import { NativeModules, Platform } from 'react-native';
39
+ import { NativeModules } from 'react-native';
40
40
  import Module from '@cpp.js/core-embind-jsi';
41
41
 
42
42
  const { RNJsiLib } = NativeModules;
@@ -51,15 +51,13 @@ function getReactNativeScript(env, modulePrefix) {
51
51
  }
52
52
 
53
53
  export function initCppJs(config = {}) {
54
- return new Promise((resolve, reject) => {
54
+ return new Promise(async (resolve, reject) => {
55
55
  if (RNJsiLib && RNJsiLib.start) {
56
- RNJsiLib.start();
57
- setTimeout(() => {
58
- setEnv();
59
- const m = Module;
60
- ${modulePrefix}
61
- resolve(Module);
62
- }, Platform.OS === 'android' ? 2000 : 0);
56
+ await RNJsiLib.start();
57
+ setEnv();
58
+ const m = Module;
59
+ ${modulePrefix}
60
+ resolve(Module);
63
61
  } else {
64
62
  reject('Module failed to initialise.');
65
63
  }