From 6ba3d419f4ad5e2e94738cc4f613034f5788d4bf Mon Sep 17 00:00:00 2001 From: Arnau Siches Date: Sat, 15 Sep 2018 15:08:14 +0100 Subject: [PATCH 1/2] Ignore node artifacts Signed-off-by: Arnau Siches --- guides/electron-apps/simple-app/.gitignore | 2 ++ guides/electron-apps/simple-app/package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 guides/electron-apps/simple-app/.gitignore diff --git a/guides/electron-apps/simple-app/.gitignore b/guides/electron-apps/simple-app/.gitignore new file mode 100644 index 0000000..d5f19d8 --- /dev/null +++ b/guides/electron-apps/simple-app/.gitignore @@ -0,0 +1,2 @@ +node_modules +package-lock.json diff --git a/guides/electron-apps/simple-app/package.json b/guides/electron-apps/simple-app/package.json index 7d4e934..cb115ce 100644 --- a/guides/electron-apps/simple-app/package.json +++ b/guides/electron-apps/simple-app/package.json @@ -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" }, From cc9c041519a779e9e7f1141dc6e00fc92dc36222 Mon Sep 17 00:00:00 2001 From: Arnau Siches Date: Sat, 15 Sep 2018 15:20:59 +0100 Subject: [PATCH 2/2] Upgrade to neon 0.2.0 Signed-off-by: Arnau Siches --- guides/hello-world/threading-hint/native/Cargo.toml | 7 ++++--- guides/hello-world/threading-hint/native/src/lib.rs | 11 +++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/guides/hello-world/threading-hint/native/Cargo.toml b/guides/hello-world/threading-hint/native/Cargo.toml index a57ac0f..acb8beb 100644 --- a/guides/hello-world/threading-hint/native/Cargo.toml +++ b/guides/hello-world/threading-hint/native/Cargo.toml @@ -1,17 +1,18 @@ [package] name = "threading-hint" -version = "0.1.0" +version = "0.2.0" authors = ["Dave Herman "] 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" diff --git a/guides/hello-world/threading-hint/native/src/lib.rs b/guides/hello-world/threading-hint/native/src/lib.rs index cfd4b21..4a635e6 100644 --- a/guides/hello-world/threading-hint/native/src/lib.rs +++ b/guides/hello-world/threading-hint/native/src/lib.rs @@ -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 { - Ok(JsNumber::new(call.scope, num_cpus::get() as f64)) +fn threading_hint(mut cx: FunctionContext) -> JsResult { + 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) });