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
// not sure I like: | |
!function(a, b){ /* ... */ }(1, 2); | |
// over: | |
(function(a, b){ /* ... */ })(1, 2); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Dojo x-domain Skeleton</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"></script> | |
<script> | |
dojo.require("dojo.DeferredList"); | |
dojo.ready(function(){ | |
var xhrs = dojo.map(["dfdlist.html", "dfdlist.html", "dfdlist.html", "dfdlist.html", "dfdlist.html"], function(url){ |
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
dojo.provide("Foo"); // always first | |
dojo.require("All.Your.Code.Are"); // always second | |
dojo.require("Belong.To.Us"); | |
(function(d){ // optional wrapper / privatizer / closure | |
// privates for this module | |
var yep = true, | |
nope = false, |
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
dojo.declare("Foo", null, { | |
constructor: function(a){ dojo.mixin(this, a); }, | |
bar: function(a, b){ | |
console.log(a, b); | |
} | |
}); | |
dojo.declare("Baz", Foo, { | |
bar: function(b, a){ | |
// "bar" is name, "arguments" is required, "[a,b] is new arguments to pass" |
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
dojo.require("dojo.io.script") | |
dojo.io.script.get({ | |
url: 'http://search.yahooapis.com/WebSearchService/V1/webSearch', | |
content: { | |
appid: 'azvpxZ_V34H8C732JoAieOR1opWXQNw0MyaG2RuMPIplVFkMnKNi8SPZ0mlgf4E-', | |
query: "foo", | |
output: 'json' | |
}, | |
timeout: 60000, |
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
dojo.declare("Foo", null, { | |
url:"/example.txt", | |
constructor: function(){ | |
dojo.xhrGet({ | |
url: this.url, | |
// pass a string as 2nd to hitch(). means this._handler(): | |
load: dojo.hitch(this, "_handler"), | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Dojo x-domain Skeleton</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="isDebug:true"></script> | |
<script> | |
dojo.ready(function(){ | |
var dojoUrl = "http://ajax.googleapis.com/ajax/libs/dojo/1.5/" | |
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 addScript(src){ | |
var script = document.createElement("script"); | |
script.src = src; | |
script.onload = script.onreadystatechange = function(e){ | |
if(e && e.type == "load" || /loaded|complete/.test(script.readyState)){ | |
script.onload = script.onreadystatechange = null; | |
console.log("foo.js added and ready"); | |
} | |
} |
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
<?php | |
// Simple single-file doc validation utility, using our php-based `jsdoc` parser. | |
// To be used as a post-commit hook? | |
// | |
// to use: | |
// php -q parsefile.php dojox/data/AndOrReadStore.js | |
// | |
// exits normally (status 0) if OK, with status 255 if failed, other values are from PHP untrapped. | |
// |
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 noteval(code, doc){ | |
// add some javascript to a document, like an iframe | |
// | |
// var iframe = document.getElementById("theframe"); | |
// noteval('alert("hi")', iframe.contentDocument || iframe.) | |
var e = doc.createElement("script"), | |
how = "text" in e ? "text" : | |
"textContent" in e ? "textContent" : |