Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Upgrade to 0.2 #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions guides/electron-apps/simple-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
package-lock.json
2 changes: 1 addition & 1 deletion guides/electron-apps/simple-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"license": "Apache-2.0",
"homepage": "https://github.com/neon-bindings/examples",
"devDependencies": {
"electron": "1.6.2",
"electron": "^2.0.9",
"electron-build-env": "^0.2",
"neon-cli": "^0.1.17"
},
Expand Down
7 changes: 4 additions & 3 deletions guides/hello-world/threading-hint/native/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[package]
name = "threading-hint"
version = "0.1.0"
version = "0.2.0"
authors = ["Dave Herman <david.herman@gmail.com>"]
license = "Apache-2.0"
build = "build.rs"
exclude = ["artifacts.json", "index.node"]

[lib]
name = "threading_hint"
crate-type = ["dylib"]

[build-dependencies]
neon-build = "0.1.17"
neon-build = "0.2.0"

[dependencies]
neon = "0.1.17"
neon = "0.2.0"
num_cpus = "1.4.0"
11 changes: 5 additions & 6 deletions guides/hello-world/threading-hint/native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
extern crate neon;
extern crate num_cpus;

use neon::vm::{Call, JsResult};
use neon::js::JsNumber;
use neon::prelude::*;

fn threading_hint(call: Call) -> JsResult<JsNumber> {
Ok(JsNumber::new(call.scope, num_cpus::get() as f64))
fn threading_hint(mut cx: FunctionContext) -> JsResult<JsNumber> {
Ok(JsNumber::new(&mut cx, num_cpus::get() as f64))
}

register_module!(m, {
m.export("threading_hint", threading_hint)
register_module!(mut cx, {
cx.export_function("threading_hint", threading_hint)
});