-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
89 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
const assert = require('assert'); | ||
const SegfaultHandler = require('segfault-handler'); | ||
SegfaultHandler.registerHandler('crash.log'); | ||
|
||
let addon = require('./dist'); | ||
|
||
let obj = new addon.MyObject(10); | ||
|
||
|
||
obj.plusTwo(10).then( (val) => { | ||
console.log("plus two is ",val); | ||
obj.plusTwo(10).then((val) => { | ||
console.log("plus two is ", val); | ||
}); | ||
|
||
obj.multiply2(-1).then( (obj3) => { | ||
console.log("multiply two ",obj3.value); | ||
obj.multiply2(-1).then((obj3) => { | ||
console.log("multiply two ", obj3.value); | ||
}); | ||
|
||
obj.sleep((msg) => { | ||
assert.equal(msg,"hello world");; | ||
assert.equal(msg, "hello world");; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
const assert = require('assert'); | ||
const SegfaultHandler = require('segfault-handler'); | ||
SegfaultHandler.registerHandler('crash.log'); | ||
|
||
let addon = require('./dist'); | ||
|
||
let t = new addon.TestObject(); | ||
t.value = 20; | ||
assert.equal(t.value2,20); | ||
assert.equal(t.value2, 20); | ||
|
||
|
||
assert.equal(addon.simple(5).value2,5); | ||
assert.equal(addon.simple(5).value2, 5); | ||
|
||
addon.create(10).then( (test_object) => { | ||
console.log("test value is %s",test_object.value2); | ||
addon.create(10).then((test_object) => { | ||
console.log("test value is %s", test_object.value2); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "node-bindgen-examples", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"segfault-handler": "^1.3.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters