Skip to content

Instantly share code, notes, and snippets.

こんにちはこんにちは!
こんにちワン!
wholeBlock: {
if (!plugins.libly) {
liberator.echoerr(__context__.NAME + ": Please install _libly.js.");
break wholeBlock;
}
if (!window.MochiKit) {
commandline.echo(<>{__context__.NAME}:<br/>
function Trampoline(func) {
this.task = new Task(func);
}
Trampoline.prototype.step = function() {
if (!this.task) return;
this.task = this.task.cont();
if (this.task) this.task.nextStep = this.step.bind(this);
};
function main() {
var d = accessAndShowEntries();
d.addCallback(function() {
console.log("finish");
});
setTimeout(function() {
console.log("cancel!");
d.cancel();
}, 2500);
}
@fujidig
fujidig / t.js
Created September 9, 2011 13:01
(function() {
var a = function() { print("a") };
a(); //=> a
function a() { print("b"); }
a(); //=> a
})();
(function() {
{
var a = function() { print("a") };
@fujidig
fujidig / t.js
Created September 16, 2011 05:18
"use strict";
function loader() Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
var a = {};
Object.defineProperty(a, "foo", {value: 1, writable: false});
print("* directly assign");
try {
@fujidig
fujidig / t.js
Created September 17, 2011 21:14
a=[1,2,3];
a[200] = 0;
a[100] = 0;
for (x in a) {
print(x)
}
@fujidig
fujidig / t.js
Created September 21, 2011 08:28
function deferredTimeout(delay) {
var deferred = new Deferred();
setTimeout(function() {
deferred.callback({
called: true
})
},
delay);
return deferred;
}
@fujidig
fujidig / t.js
Created September 21, 2011 09:39
function deferredTimeout(delay) {
var deferred = new Deferred();
window.setTimeout(function() {
deferred.callback({});
},
delay);
return deferred;
}
function yieldToAwait(src) {