caoccao / javenode Goto Github PK
View Code? Open in Web Editor NEWJavenode is Java + V8 + Node.js. It is a Node.js simulator with Java in V8.
Home Page: https://www.caoccao.com/Javenode/
License: Apache License 2.0
Javenode is Java + V8 + Node.js. It is a Node.js simulator with Java in V8.
Home Page: https://www.caoccao.com/Javenode/
License: Apache License 2.0
build.gradle:
implementation 'com.caoccao.javet:javet-android:3.0.4'
implementation "com.caoccao.javet:javenode:0.4.0"
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class com.caoccao.javet.annotations.CheckReturnValue found in modules javet-3.0.3 (com.caoccao.javet:javet:3.0.3) and javet-android-3.0.4-runtime (com.caoccao.javet:javet-android:3.0.4)
I've done various examples with lambda-style js in microservices contexts, bundled using for example esbuild. The blocker for real world applications in those cases has always been that there are legitimate needs for consuming HTTP resources or emitting HTTP side effects.
What's your take on this?
While the http
and https
Node APIs are quite big, an alternative would be to maintain compatibility with node-fetch instead. Bundles could embed the node-fetch
lib (which at runtime depends on http, https, zlib, stream ... and more) or somehow allow it to be injected/require
d/import
ed.
@test
public void SetInterval() throws InterruptedException {
try {
V8Runtime v8Runtime = V8Host.getV8Instance().createV8Runtime();
JNEventLoop eventLoop = new JNEventLoop(v8Runtime);
eventLoop.loadStaticModules(JNModuleType.Console, JNModuleType.Timers);
v8Runtime.getExecutor("const a = [];\n" +
"setInterval(() => console.log(2342), 1000);").executeVoid();
eventLoop.await();
} catch (JavetException | InterruptedException e) {
throw new RuntimeException(e);
}
Thread.sleep(10000);
}
这样执行是正常的。
但是实例无法工作正常【如下:】
@test
public void SetInterval() throws InterruptedException {
try (V8Runtime v8Runtime = V8Host.getV8Instance().createV8Runtime();
JNEventLoop eventLoop = new JNEventLoop(v8Runtime)) {
eventLoop.loadStaticModules(JNModuleType.Console, JNModuleType.Timers);
v8Runtime.getExecutor("const a = [];\n" +
"setInterval(() => console.log(23423), 1000);").executeVoid();
eventLoop.await();
} catch (JavetException | InterruptedException e) {
throw new RuntimeException(e);
}
Thread.sleep(100000);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.