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
$ ls | |
binding.gyp hello.cc | |
$ echo ~/.node* | |
/data/data/com.termux/files/home/.node* | |
$ node-gyp configure build |& tee build.log | |
gyp info it worked if it ends with ok | |
gyp verb cli [ '/data/data/com.termux/files/usr/bin/node', | |
gyp verb cli '/data/data/com.termux/files/usr/bin/node-gyp', | |
gyp verb cli '-v', |
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
// node v0.11.4 --harmony | |
function forof(g,cb) { // non-generator callbacks only | |
var r; | |
while(true) { | |
r = g.next(); | |
if (r.done) break; // skip return value? | |
cb(r.value); | |
} | |
} |
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
// <script> | |
/* sample output | |
$ node ../bind-for-arrows.html | |
_this: 4ms | |
.bind: 25ms | |
bind: 4ms | |
_this, calls only: 1ms | |
.bind, calls only: 4ms | |
bind, calls only: 0ms |
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
declare function setImmediate(cb); | |
declare function setTimeout(cb,n); | |
declare var process; | |
function nextTick(cb) { | |
if (typeof setImmediate == "function") { | |
setImmediate(cb); | |
} else if (typeof process == "object" && typeof process.nextTick == "function") { | |
process.nextTick(cb); | |
} else if (typeof setTimeout == "function") { |
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
declare function setImmediate(cb); | |
declare function setTimeout(cb,n); | |
declare var process; | |
function nextTick(cb) { | |
if (typeof setImmediate == "function") { | |
setImmediate(cb); | |
} else if (typeof setTimeout == "function") { | |
setTimeout(cb,0); | |
} else if (typeof process == "object" && typeof process.nextTick == "function") { |
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
// see console output <script> | |
// quick hack of classes implementing interfaces, just to give the idea; for a | |
// proper design, feel free to use better syntax, (Weak)Maps, unique symbols, ..; | |
// | |
// the core idea is to relate interfaces to classes that implement them, in | |
// such a way that the relevant implementations of interface methods can be | |
// extracted systematically in generic code | |
var Mappable = {}; // interface, to be implemented by classes; |
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
/* | |
Copyright (C) 2012 Ariya Hidayat <[email protected]> | |
Copyright (C) 2012 Mathias Bynens <[email protected]> | |
Copyright (C) 2012 Joost-Wim Boekesteijn <[email protected]> | |
Copyright (C) 2012 Kris Kowal <[email protected]> | |
Copyright (C) 2012 Yusuke Suzuki <[email protected]> | |
Copyright (C) 2012 Arpad Borsos <[email protected]> | |
Copyright (C) 2011 Ariya Hidayat <[email protected]> | |
Redistribution and use in source and binary forms, with or without |
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
// basil (bridging ASI and layout) | |
// | |
// unfinished sketch; Claus Reinke 2012 | |
// | |
// $ node basil.js sample.js | |
// ASI at line 5(2), before indented line 6(8) | |
// no ASI at line 12(2), before non-indented line 13(2) | |
// ASI at line 25(2) before indented line 26(11) | |
// no ASI at line 35(2), before non-indented line 36(2) | |
// no ASI at line 39(2), before non-indented line 40(2) |