commit | b4d1d9da75f2e5f9dcf77feb879f3974436dad1e | [log] [tgz] |
---|---|---|
author | Todd Wang <toddw@google.com> | Thu Mar 17 20:45:39 2016 -0700 |
committer | Todd Wang <toddw@google.com> | Thu Mar 17 20:45:39 2016 -0700 |
tree | db5f0826e9c60fa45537dcc4492acd18e3637f2e | |
parent | f717b2332ed7e5cd71db141d19cc8c33a21bc95e [diff] |
js.core: Fix native type consts, and gen 0 values for all types. We had a TODO to fix consts with native types, since they didn't work at all. The strategy is to create the 0-valued wire type, and call vdl.Convert to convert to the native type. We inline a func literal to do this for us, which means we can call it in the natural spot without creating temporary variables. The downside is that the generated code looks a little ugly. We use this functionality to generate zero values for all types defined in each package. This will be useful for Benj's FromZero changes, and was also useful in spotting weird behavior. Also changed typeGoInternal to be typeGoWire. The idea is that sometimes we want to force the wire type to be generated, but only for the top-level type, so it makes more sense to split the functions into wire / non-wire versions, rather than passing a bool around that we ignore everywhere except the top level. And fixed the isNativeType logic. I should have spotted this in an earlier review; we should never call vdl.SplitIdent in the codegen package, since we have the full compile.Env, and can just look up anything we need. And finally - changed the unnamed targets to use an incrementing number with a unique prefix, rather than the hex hash of the type. This is much more readable, and the hex hashes were really long and annoying. MultiPart: 4/6 Change-Id: Idaadfadc6994151d0371f228213c7ac267c7b47e
This repository defines the JavaScript API for Vanadium. The client and server APIs defined here work both in Node.js and the browser.
npm install --save vanadium/js
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