Running V8 Javascript Engine Standalone

前端 未结 9 1871
悲&欢浪女
悲&欢浪女 2020-11-27 09:05

I want to run a Javascript console on top of V8. How do I do this?

9条回答
  •  一整个雨季
    2020-11-27 09:50

    After following the build instructions (Google's V8 Build Docs) for your system;

    [v8 directory]$ cd out/native
    [v8 directory]$ ./shell (sample shell)
    [v8 directory]$ ./d8 (console: dumb)
    

    I created an alias in my .bash_profile to facilitate invocation of the shell.

    alias v8='/Volumes/Dev/GitHub/v8/out/native/shell'
    

    Typing v8 at the CLI (in a new Terminal or shell -- to reload your bash profile) yields the v8 shell. JavaScript at the command prompt! :)

提交回复
热议问题