GithubHelp home page GithubHelp logo

caoccao / javenode Goto Github PK

View Code? Open in Web Editor NEW
46.0 46.0 5.0 838 KB

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

Java 97.98% Python 2.02%
android engine java java-v8 javascript javet linux macos nodejs v8 v8-javascript-engine windows

javenode's Introduction

javenode's People

Contributors

caoccao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

javenode's Issues

Can Javenode support Android? I am using it on Android and received an error message

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)

node-fetch support

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/required/imported.

实例代码好像有问题

@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);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.