commit | 12ab2a9b2881d6334228a9a7d867db9d5b1445b5 | [log] [tgz] |
---|---|---|
author | Ali Ghassemi <aghassemi@google.com> | Mon Sep 14 09:28:22 2015 -0700 |
committer | Ali Ghassemi <aghassemi@google.com> | Mon Sep 14 09:28:22 2015 -0700 |
tree | 6ef6aec4b8dcae32877e1672ed7fe17e8a34aec0 | |
parent | a6874a3ee65afd91764129e2f6bbffca2d3e58d5 [diff] |
javascript: Server and Client API Changes. This with CL JavaScript' server API is changing to match the new server API in Go and also client API is chaning a bit so it is more consistent. Server API Changes: Changes are made to align with the server API changes in Go that was submitted with http:/v.io/c/15257 In short, server.serve and server.serveDispatcher were removed from the server object and new asynchronous methods were added to runtime so users can create a server object at the same time as starting the server. ` var server = rt.newServer(); server.serve(name, serviceObject, cb); ` is changing to: ` rt.newServer(name, serviceObject, cb); ` a server object will be passed to cb. With this change, runtime.newServer no longer immediately returns a server object, instead it also takes in the serviceObject and a name and creates AND starts the server before returning it. new method runtime.newDispatchingServer was also added to replace the server.serveDispatcher. Client API Changes: Now that runtime.newServer is asynchronous, having runtime.newClient be synchronous would have been inconsistent, also Go side is removing the ability to create multiple clients anyway. Therefore with this cl runtime.newClient was renamed to runtime.getClient which would return a singleton client object. runtime.namespace was also renamed to runtime.getNamespace to be consistent with runtime.getContext and runtime.getClient MultiPart: 2/10 Change-Id: I47415bfa42070f36c6b2f08c53ef5fb034cb320f
This repository defines the JavaScript API for Vanadium. The client and server APIs defined here work both in Node.js and the browser.
Since Vanadium is currently hosted in private repositories, you would need to [setup SSH keys for Github] (https://help.github.com/articles/generating-ssh-keys/) first and then use npm to install directly from GitHub:
npm install --save git+ssh://git@github.com:vanadium/js.git
Documentation for this API is available at https://jsdoc.v.io/ Tutorials can be found at https://v.io/tutorials/javascript/
The entry point to the API is through a module called vanadium
, everything else is considered private and should not be accessed by the users of the API.
The vanadium
module is exported as a global in the browser JavaScript library and for Browserify and Node.js the “main” property in the package.json
points to /src/vanadium
making it the index module and therefore Browserify and Node.js users can gain access to the API with:
var vanadium = require("vanadium");
One of the goals of this project is to only write the code once and have it run in both Node.js and browsers. Therefore, specific build and testing steps have been designed in the project to ensure this goal.
When run in a browser, vanadium.js
expects that the vanadium extension will be installed.
Bugs and feature requests should be filed in the Vanadium issue tracker.
GNU Make is used to build and test Vanadium.
Build everything:
make build
Test everything:
make test
Run a specific test suite:
make test-unit make test-unit-node make test-unit-browser make test-integration make test-integration-node make test-integration-browser
Remove all build and testing artifacts:
make clean