Code Monkey home page Code Monkey logo

v8plugin's Introduction

v8plugin

autojs的v8引擎插件

这个插件基于Javet项目,Javet提供了v8引擎与java交互的能力

示例

let v8plugin = $plugins.load("com.aiselp.autojs.v8plugin");

let v8 = v8plugin.createV8Engine();
events.on('exit', () => {
    v8.destroy()
})

//注入一个java对象给v8引擎使用
v8.inject('console', runtime.console);
let t = {
    f: 6
}
v8.inject('val', t)
v8.execJsString(`
   val.c = 0;
   console.log(val);
`)

sleep(1000);
//性能测试
let jscode = `
var a = 0;
console.log("测试开始")
console.log("当前引擎:"+
(typeof id=='function'?'Rhino':'V8'))
var time = Date.now();

while (a < 5000 * 1000) {
    a++
}
console.log("测试结束,耗时:"+(Date.now()-time)+"ms");
`

v8.execJsString(jscode)
//sleep(1000)
eval(jscode)

v8plugin's People

Contributors

aiselp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

v8plugin's Issues

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.