Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nodejs/node-addon-examples
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 981d08d556942cd68201e8ff82dd875f596d588e
Choose a base ref
..
head repository: nodejs/node-addon-examples
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 70dd8935e9de7df1ea6d0ea19177d7108c8b61a9
Choose a head ref
4 changes: 2 additions & 2 deletions 1_hello_world/node_4.x/hello.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var addon = require('bindings')('hello');
const addon = require('bindings')('hello');

console.log(addon.hello()); // 'world'
console.log(addon.hello()); // 'world'
4 changes: 2 additions & 2 deletions 2_function_arguments/node_4.x/addon.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var addon = require('bindings')('addon.node')
const addon = require('bindings')('addon.node');

console.log('This should be eight:', addon.add(3, 5))
console.log('This should be eight:', addon.add(3, 5));
6 changes: 2 additions & 4 deletions 3_callbacks/node_4.x/addon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var addon = require('bindings')('addon');
const addon = require('bindings')('addon');

addon(function(msg){
console.log(msg); // 'hello world'
});
addon(msg => console.log(msg)); // 'hello world'
addon(); // nothing
6 changes: 3 additions & 3 deletions 4_object_factory/node_4.x/addon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var addon = require('bindings')('addon');
const addon = require('bindings')('addon');

var obj1 = addon('hello');
var obj2 = addon('world');
const obj1 = addon('hello');
const obj2 = addon('world');
console.log(obj1.msg + ', ' + obj2.msg); // 'hello, world'
4 changes: 2 additions & 2 deletions 5_function_factory/node_4.x/addon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var addon = require('bindings')('addon');
const addon = require('bindings')('addon');

var fn = addon();
const fn = addon();
console.log(fn()); // 'hello, world'
6 changes: 3 additions & 3 deletions 6_object_wrap/node_4.x/addon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var addon = require('bindings')('addon');
const addon = require('bindings')('addon');

var obj = new addon.MyObject(10);
const obj = new addon.MyObject(10);
console.log( obj.plusOne() ); // 11
console.log( obj.plusOne() ); // 12
console.log( obj.plusOne() ); // 13
console.log( obj.plusOne() ); // 13
6 changes: 3 additions & 3 deletions 7_factory_wrap/node_4.x/addon.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var createObject = require('bindings')('addon');
const createObject = require('bindings')('addon');

var obj = createObject(10);
const obj = createObject(10);
console.log( obj.plusOne() ); // 11
console.log( obj.plusOne() ); // 12
console.log( obj.plusOne() ); // 13

var obj2 = createObject(20);
const obj2 = createObject(20);
console.log( obj2.plusOne() ); // 21
console.log( obj2.plusOne() ); // 22
console.log( obj2.plusOne() ); // 23
8 changes: 4 additions & 4 deletions 8_passing_wrapped/node_4.x/addon.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var addon = require('bindings')('addon');
const addon = require('bindings')('addon');

var obj1 = addon.createObject(10);
var obj2 = addon.createObject(20);
var result = addon.add(obj1, obj2);
const obj1 = addon.createObject(10);
const obj2 = addon.createObject(20);
const result = addon.add(obj1, obj2);

console.log(result); // 30