Git Product home page Git Product logo

v8worker2's Introduction

v8worker2

Build Status

This is a minimal binding between Go (golang) and V8 JavaScript. Basic concept is to only expose two methods to JavaScript: send and receive.

V8 Version: 6.9.427.19 (August 2018)

A rather dated presentation on this project

Installing

Due to the complexity of building V8, this package is not buildable with go get.

To install:

go get github.com/ry/v8worker2
cd `go env GOPATH`/src/github.com/ry/v8worker2
./build.py # Will take ~30 minutes to compile.
go test

If you have ccache installed, ./build.py --use_ccache will take advantage of it. This is useful to avoid rebuilding V8 so much.

JavaScript API

The JavaScript interface is exposed thru a single global namespace V8Worker2. The interface has just three methods V8Worker2.print(), V8Worker2.send(), and V8Worker2.recv(). See v8worker2.d.ts for the details.

Golang API

Documentation is at https://godoc.org/github.com/ry/v8worker2 and example usage is at worker_test.go

Difference from the original v8worker

  • The original v8worker passed strings between Go and V8. v8worker2 instead communicates using ArrayBuffer, which is more efficient.

  • The original included recvSync and sendSync methods. These were deemed unnecessary. Now send() can operate both sychronously by returning another ArrayBuffer. Simply return a []byte from the golang recv callback.

  • This version is compatible with modern V8, has a better build setup, and uses Travis for CI.

  • The original prefixed the methods with dollar signs, this version uses a global name space object and provides a typescript declaration file.

License

MIT License. Contributions welcome.

	Copyright 2015-2018 Ryan Dahl <[email protected]>. All rights reserved.

	Permission is hereby granted, free of charge, to any person obtaining a copy
	of this software and associated documentation files (the "Software"), to
	deal in the Software without restriction, including without limitation the
	rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
	sell copies of the Software, and to permit persons to whom the Software is
	furnished to do so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in
	all copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
	IN THE SOFTWARE.

v8worker2's People

Contributors

ry avatar qti3e avatar phated avatar brandonmanke avatar dlespiau avatar matiasinsaurralde avatar varun1729 avatar ohsory1324 avatar

Watchers

 avatar

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.