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
// Spawn function inspired by Q.async at http://wiki.ecmascript.org/doku.php?id=strawman:async_functions#reference_implementation | |
// Takes an ES6 generator function and produces a WinJS.Promise | |
function spawn(generatorFunc) { | |
return new WinJS.Promise(function (c, e) { | |
var generator = generatorFunc(); | |
var callback = continuer.bind(void 0, 'send'); | |
var errback = continuer.bind(void 0, 'throw'); | |
function continuer(verb, valueOrErr) { | |
var promisedValue; |
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
// If you are starting with a file from a picker, something like this should work: | |
var picker = new Windows.Storage.Pickers.FileOpenPicker(); | |
picker.fileTypeFilter.replaceAll(['.jpg', '.jpeg']); | |
picker.pickSingleFileAsync().then(function (file) { | |
return file.openAsync(Windows.Storage.FileAccessMode.read); | |
}).done(function (ras) { | |
var blob = MSApp.createBlobFromRandomAccessStream('image/jpeg', ras); |
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
Things I want to be able to do: | |
a) Bind a name to a remote module | |
b) Alias a name for a module | |
c) Alias a name for a member of a remote module | |
d) Put all names from inside a module in lexical scope | |
e) Put all names from inside a remote module in lexical scope | |
f) Put a few names from inside a module in lexical scope | |
g) Define a local module | |
h) Export names from lexical scope | |
i) Re-export names from other modules |
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
//#1 | |
// Current spec would suggest that this is an early error during compilation of the main code. | |
// However, dynamically, the "x=20" will write to the "var x" declared inside g. | |
// This is a case where the early error for assignments to const variables appears to overreach, flagging an error which will not actually occur if the code were allowed to run. | |
function f() { | |
const x = 5; | |
function g() { | |
eval(“var x = 10”); | |
x = 20; | |
} |
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
(function (global) { | |
// TODO: Delegate to parent loader in various places | |
// TODO: Canonicalization | |
// TODO: Can we do better for 'eval'? | |
/// Module loader constructor | |
function Loader(parent, options) { | |
// Initialization of loader state from options |
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
/* | |
// The default system module loader exposed by ES6 on the | |
// global object. | |
Object.system = { | |
load: function(name, callback, errback) { | |
// ... | |
}, | |
loaded: {} | |
} | |
*/ |
NewerOlder