Skip to content

Commit 31f6270

Browse files
author
Mushaheed Syed
authored
Merge pull request #3 from predatorx7/add_jetpack_javascriptengine
Add jetpack javascript engine
2 parents 2455f89 + dbe40fc commit 31f6270

125 files changed

Lines changed: 2080 additions & 98070 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/javascript/javascript/README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
1-
# Javascript
1+
# JavaScript
22

3-
Enable your app to evaluate javascript programs. A simple library that provides a javascript runtime where you can run your javascript.
3+
Enable your app to evaluate javascript programs. A simple library that provides a javascript environment where you can run your javascript code.
4+
5+
## Advantages
6+
7+
For applications requiring non-interactive JavaScript evaluation, using this JavaScript library has the following advantages:
8+
9+
- Lower resource consumption, since there is no need to allocate a WebView instance.
10+
- Multiple isolated javascript environments with low overhead, enabling the application to run several JavaScript snippets simultaneously.
11+
- Provides implementation for setTimeout in the javascript environment.
12+
- Support for javascript channels for sending asynchronous messages from javascript environment to host and then receive a reply asynchronously as Promise.
13+
- Supports loading javaScript code from a file and then evaluate it for efficient evaluation of large scripts that may be expensive to pass as a String.
14+
15+
## Implementation
16+
17+
### Android
18+
19+
The Android plugin [javascript_android] implementation uses the [JavaScriptIsolate](https://developer.android.com/reference/kotlin/androidx/javascriptengine/JavaScriptIsolate) as the javascript environment from the [Android Jetpack JavaScript Engine](https://developer.android.com/reference/kotlin/androidx/javascriptengine) library.
20+
21+
### iOS & MacOS
22+
23+
The iOS, & MacOS plugin [javascript_darwin] implementation uses [JSContext](https://developer.apple.com/documentation/javascriptcore/jscontext) from [Apple's JavaScriptCore](https://developer.apple.com/documentation/javascriptcore) framework.
24+
25+
## Using
26+
27+
The easiest way to use this library is via the high-level interface defined by [JavaScript] class.
28+
29+
___
430

531
Developed with 💙 by [Reclaim Protocol Team][reclaimprotocol_link]
632

packages/javascript/javascript/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1515
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1616
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
17+
C18B3414394AF2B7D715038F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE53F133A9F3BB6133AF9097 /* Pods_Runner.framework */; };
18+
F4C7252B52516FA16F1A222C /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35AEE5AE5D4DD0190C00785B /* Pods_RunnerTests.framework */; };
1719
/* End PBXBuildFile section */
1820

1921
/* Begin PBXContainerItemProxy section */
@@ -40,11 +42,16 @@
4042
/* End PBXCopyFilesBuildPhase section */
4143

4244
/* Begin PBXFileReference section */
45+
0CCFC7F62B43C040398F1023 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
4346
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4447
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
48+
310D22F9A35A3CF9422D69AE /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
4549
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
4650
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
51+
35AEE5AE5D4DD0190C00785B /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4752
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
53+
47634C540BFF1FDF01E5B0C0 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
54+
71F017915446B3AE64C7186C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
4855
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
4956
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5057
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@@ -55,13 +62,25 @@
5562
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5663
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5764
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
65+
9B56F23C0F6328AB5ED79AA8 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
66+
C7AD750105693F3956607AF2 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
67+
CE53F133A9F3BB6133AF9097 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5868
/* End PBXFileReference section */
5969

6070
/* Begin PBXFrameworksBuildPhase section */
71+
562F4CC1C5DFE72356BA0E49 /* Frameworks */ = {
72+
isa = PBXFrameworksBuildPhase;
73+
buildActionMask = 2147483647;
74+
files = (
75+
F4C7252B52516FA16F1A222C /* Pods_RunnerTests.framework in Frameworks */,
76+
);
77+
runOnlyForDeploymentPostprocessing = 0;
78+
};
6179
97C146EB1CF9000F007C117D /* Frameworks */ = {
6280
isa = PBXFrameworksBuildPhase;
6381
buildActionMask = 2147483647;
6482
files = (
83+
C18B3414394AF2B7D715038F /* Pods_Runner.framework in Frameworks */,
6584
);
6685
runOnlyForDeploymentPostprocessing = 0;
6786
};
@@ -94,6 +113,8 @@
94113
97C146F01CF9000F007C117D /* Runner */,
95114
97C146EF1CF9000F007C117D /* Products */,
96115
331C8082294A63A400263BE5 /* RunnerTests */,
116+
F5C7AB9347B53C7AD92D7BE3 /* Pods */,
117+
D79F224981C525B33C0BC556 /* Frameworks */,
97118
);
98119
sourceTree = "<group>";
99120
};
@@ -121,15 +142,40 @@
121142
path = Runner;
122143
sourceTree = "<group>";
123144
};
145+
D79F224981C525B33C0BC556 /* Frameworks */ = {
146+
isa = PBXGroup;
147+
children = (
148+
CE53F133A9F3BB6133AF9097 /* Pods_Runner.framework */,
149+
35AEE5AE5D4DD0190C00785B /* Pods_RunnerTests.framework */,
150+
);
151+
name = Frameworks;
152+
sourceTree = "<group>";
153+
};
154+
F5C7AB9347B53C7AD92D7BE3 /* Pods */ = {
155+
isa = PBXGroup;
156+
children = (
157+
9B56F23C0F6328AB5ED79AA8 /* Pods-Runner.debug.xcconfig */,
158+
C7AD750105693F3956607AF2 /* Pods-Runner.release.xcconfig */,
159+
71F017915446B3AE64C7186C /* Pods-Runner.profile.xcconfig */,
160+
0CCFC7F62B43C040398F1023 /* Pods-RunnerTests.debug.xcconfig */,
161+
310D22F9A35A3CF9422D69AE /* Pods-RunnerTests.release.xcconfig */,
162+
47634C540BFF1FDF01E5B0C0 /* Pods-RunnerTests.profile.xcconfig */,
163+
);
164+
name = Pods;
165+
path = Pods;
166+
sourceTree = "<group>";
167+
};
124168
/* End PBXGroup section */
125169

126170
/* Begin PBXNativeTarget section */
127171
331C8080294A63A400263BE5 /* RunnerTests */ = {
128172
isa = PBXNativeTarget;
129173
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
130174
buildPhases = (
175+
07B0E66F96123F84A12BE111 /* [CP] Check Pods Manifest.lock */,
131176
331C807D294A63A400263BE5 /* Sources */,
132177
331C807F294A63A400263BE5 /* Resources */,
178+
562F4CC1C5DFE72356BA0E49 /* Frameworks */,
133179
);
134180
buildRules = (
135181
);
@@ -145,12 +191,14 @@
145191
isa = PBXNativeTarget;
146192
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
147193
buildPhases = (
194+
34771D4095194AD893A4FF68 /* [CP] Check Pods Manifest.lock */,
148195
9740EEB61CF901F6004384FC /* Run Script */,
149196
97C146EA1CF9000F007C117D /* Sources */,
150197
97C146EB1CF9000F007C117D /* Frameworks */,
151198
97C146EC1CF9000F007C117D /* Resources */,
152199
9705A1C41CF9048500538489 /* Embed Frameworks */,
153200
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
201+
6D85BD65D456EC00FD8C7CF9 /* [CP] Embed Pods Frameworks */,
154202
);
155203
buildRules = (
156204
);
@@ -222,6 +270,50 @@
222270
/* End PBXResourcesBuildPhase section */
223271

224272
/* Begin PBXShellScriptBuildPhase section */
273+
07B0E66F96123F84A12BE111 /* [CP] Check Pods Manifest.lock */ = {
274+
isa = PBXShellScriptBuildPhase;
275+
buildActionMask = 2147483647;
276+
files = (
277+
);
278+
inputFileListPaths = (
279+
);
280+
inputPaths = (
281+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
282+
"${PODS_ROOT}/Manifest.lock",
283+
);
284+
name = "[CP] Check Pods Manifest.lock";
285+
outputFileListPaths = (
286+
);
287+
outputPaths = (
288+
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
289+
);
290+
runOnlyForDeploymentPostprocessing = 0;
291+
shellPath = /bin/sh;
292+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
293+
showEnvVarsInLog = 0;
294+
};
295+
34771D4095194AD893A4FF68 /* [CP] Check Pods Manifest.lock */ = {
296+
isa = PBXShellScriptBuildPhase;
297+
buildActionMask = 2147483647;
298+
files = (
299+
);
300+
inputFileListPaths = (
301+
);
302+
inputPaths = (
303+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
304+
"${PODS_ROOT}/Manifest.lock",
305+
);
306+
name = "[CP] Check Pods Manifest.lock";
307+
outputFileListPaths = (
308+
);
309+
outputPaths = (
310+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
311+
);
312+
runOnlyForDeploymentPostprocessing = 0;
313+
shellPath = /bin/sh;
314+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
315+
showEnvVarsInLog = 0;
316+
};
225317
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
226318
isa = PBXShellScriptBuildPhase;
227319
alwaysOutOfDate = 1;
@@ -238,6 +330,23 @@
238330
shellPath = /bin/sh;
239331
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
240332
};
333+
6D85BD65D456EC00FD8C7CF9 /* [CP] Embed Pods Frameworks */ = {
334+
isa = PBXShellScriptBuildPhase;
335+
buildActionMask = 2147483647;
336+
files = (
337+
);
338+
inputFileListPaths = (
339+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
340+
);
341+
name = "[CP] Embed Pods Frameworks";
342+
outputFileListPaths = (
343+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
344+
);
345+
runOnlyForDeploymentPostprocessing = 0;
346+
shellPath = /bin/sh;
347+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
348+
showEnvVarsInLog = 0;
349+
};
241350
9740EEB61CF901F6004384FC /* Run Script */ = {
242351
isa = PBXShellScriptBuildPhase;
243352
alwaysOutOfDate = 1;
@@ -379,6 +488,7 @@
379488
};
380489
331C8088294A63A400263BE5 /* Debug */ = {
381490
isa = XCBuildConfiguration;
491+
baseConfigurationReference = 0CCFC7F62B43C040398F1023 /* Pods-RunnerTests.debug.xcconfig */;
382492
buildSettings = {
383493
BUNDLE_LOADER = "$(TEST_HOST)";
384494
CODE_SIGN_STYLE = Automatic;
@@ -396,6 +506,7 @@
396506
};
397507
331C8089294A63A400263BE5 /* Release */ = {
398508
isa = XCBuildConfiguration;
509+
baseConfigurationReference = 310D22F9A35A3CF9422D69AE /* Pods-RunnerTests.release.xcconfig */;
399510
buildSettings = {
400511
BUNDLE_LOADER = "$(TEST_HOST)";
401512
CODE_SIGN_STYLE = Automatic;
@@ -411,6 +522,7 @@
411522
};
412523
331C808A294A63A400263BE5 /* Profile */ = {
413524
isa = XCBuildConfiguration;
525+
baseConfigurationReference = 47634C540BFF1FDF01E5B0C0 /* Pods-RunnerTests.profile.xcconfig */;
414526
buildSettings = {
415527
BUNDLE_LOADER = "$(TEST_HOST)";
416528
CODE_SIGN_STYLE = Automatic;

packages/javascript/javascript/example/ios/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/javascript/javascript/example/lib/json.dart

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)