Browse Source

update examples and docs

master
AJ ONeal 5 years ago
parent
commit
aa5873164a
  1. 27
      README.md
  2. 31
      example.js

27
README.md

@ -25,3 +25,30 @@ console.log(hello);
hello.any();
```
```bash
node example.js
```
## How I made this
1. Install [Node.js](https://nodejs.org).
2. Install build tools
* macOS: XCode and `xcode-select install` (CLI Tools)
* Windows: `npm install --global --production windows-build-tools`
* Ubuntu: `sudo apt install -y build-essential`
3. Install Rust
4. Install neon; Create (and rename) project
```bash
npm install --global neon-cli
neon version
neon new hello.neon
mv hello.neon hello.neon.js
pushd hello.neon.js
neon build
```
Then I just followed along in
[the docs](https://neon-bindings.com/docs/hello-world)
and [the examples](https://github.com/neon-bindings/examples)

31
example.js

@ -0,0 +1,31 @@
'use strict';
var hello = require('.');
//var hello = require('hello.neon');
console.log('hello()', hello.hello());
console.log('threadCount()', hello.threadCount());
console.log('greet("Bob")', hello.greet("Bob"));
console.log('noop()', hello.noop());
console.log('any()', hello.any());
console.log('any()', hello.any());
console.log('any()', hello.any());
console.log('any()', hello.any());
console.log('any()', hello.any());
console.log('any()', hello.any());
console.log('any()', hello.any());
if (Math.round(Math.random() * 1)) {
console.log('throw()');
console.log(hello.throw());
} else {
try {
console.log(console.log('panic()'));
console.log(hello.panic());
} catch(e) {
console.error('caught error:');
console.error(e);
}
}
console.log("all done");
Loading…
Cancel
Save