Last active
August 29, 2015 14:10
-
-
Save eventualbuddha/c31c87c0a98372844840 to your computer and use it in GitHub Desktop.
CJS Revamp Proposal
This file contains hidden or 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
"use strict"; | |
exports.incr = incr; | |
var __esBindingListeners = []; | |
function __esBindingSet(name, value) { | |
exports[name] = value; | |
for (var i = 0, l = __esBindingListeners.length; i < l; i++) { | |
__esBindingListeners[i](name, value); | |
} | |
} | |
function __esBindingListen(callback) { | |
__esBindingListeners.push(callback); | |
} | |
exports.__esBindingListen = __esBindingListen; | |
var count = 0; | |
function incr() { | |
count++, __esBindingSet("count", count); | |
} | |
__esBindingSet("count", count); |
This file contains hidden or 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
export var count = 0; | |
export function incr() { | |
count++; | |
} |
This file contains hidden or 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
"use strict"; | |
var exporter$$ = require("./exporter"), count = exporter$$.count, incr = exporter$$.incr; | |
exporter$$.__esBindingListen && exporter$$.__esBindingListen(function(__esBindingName, __esBindingValue) { | |
switch (__esBindingName) { | |
case "count": | |
count = __esBindingValue; | |
break; | |
case "incr": | |
incr = __esBindingValue; | |
break; | |
} | |
}); | |
assert.equal(count, 0); | |
incr(); | |
assert.equal(count, 1); |
This file contains hidden or 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
import { count, incr } from './exporter'; | |
assert.equal(count, 0); | |
incr(); | |
assert.equal(count, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment