cpp.js 1.0.0-beta.23 → 1.0.0-beta.24
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/package.json
CHANGED
|
@@ -30,10 +30,7 @@ export default function getCppJsScript(platform, bridgePath = null) {
|
|
|
30
30
|
return `
|
|
31
31
|
export let AllSymbols = {};
|
|
32
32
|
${symbolExportDefineString}
|
|
33
|
-
|
|
34
|
-
export function initCppJs(config = {}) {
|
|
35
|
-
${getPlatformScript(env, scriptContent)}
|
|
36
|
-
}
|
|
33
|
+
${getPlatformScript(env, scriptContent)}
|
|
37
34
|
`;
|
|
38
35
|
}
|
|
39
36
|
|
|
@@ -53,17 +50,19 @@ function getReactNativeScript(env, modulePrefix) {
|
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
RNJsiLib.start
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
export function initCppJs(config = {}) {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
if (RNJsiLib && RNJsiLib.start) {
|
|
56
|
+
RNJsiLib.start();
|
|
57
|
+
setEnv();
|
|
58
|
+
const m = Module;
|
|
59
|
+
${modulePrefix}
|
|
60
|
+
resolve(Module);
|
|
61
|
+
} else {
|
|
62
|
+
reject('Module failed to initialise.');
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
67
66
|
`;
|
|
68
67
|
}
|
|
69
68
|
|
|
@@ -78,13 +77,15 @@ function getWebScript(env, modulePrefix) {
|
|
|
78
77
|
}`;
|
|
79
78
|
|
|
80
79
|
return `
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
export function initCppJs(config = {}) {
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
import('/cpp.js').then(n => {
|
|
83
|
+
return window.CppJs.initCppJs(${params});
|
|
84
|
+
}).then(m => {
|
|
85
|
+
${modulePrefix}
|
|
86
|
+
resolve(m);
|
|
87
|
+
});
|
|
87
88
|
});
|
|
88
|
-
}
|
|
89
|
+
}
|
|
89
90
|
`;
|
|
90
91
|
}
|