Skip to content

Instantly share code, notes, and snippets.

View neonstalwart's full-sized avatar

Ben Hockey neonstalwart

  • google.com
  • Boulder, CO
View GitHub Profile
// this is 'raw' javascript to load dojo, stylesheets, the app, etc.
// this file is all that needs to be included in the host page.
// this technique doesn't dojo.addOnLoad because it assumes that the
// app code will use dojo.addOnLoad as necessary.
// also, this doesn't load dojo.css as a 'reset' since it assumes that
// it is being loaded into an already established environment and it
// doesn't include loading the css for a dijit theme.
var d = new dojo.Deferred();
d.addErrback(function(){
console.log('first error handler');
});
d.addErrback(function(){
console.log('2nd error handler');
});
<html>
<head>
<title>Dojo Test Page</title>
<link rel='stylesheet' type='text/css' href='http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/resources/dojo.css'>
<link rel='stylesheet' type='text/css' href='http://ajax.googleapis.com/ajax/libs/dojo/1.4/dijit/themes/tundra/tundra.css'>
<script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js'></script>
<script type="text/javascript">
dojo.require('dijit._Widget');
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Promise</title>
<script src="http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js">
</script>
<script type="text/javascript">
dojo.provide("dojox.Promise");
@neonstalwart
neonstalwart / api.js
Created January 31, 2010 03:00
a script to do the conversion of dojo's api.xml into scriptdoc format
dojo.require('dojox.dtl');
dojo.require("dojox.dtl.Context");
dojo.addOnLoad(function(){
var url = 'http://download.dojotoolkit.org/release-1.4.0/api.json';
dojo.xhrGet({
url: url,
handleAs: "json"
}).addCallback(function(data){
var template = new dojox.dtl.Template(
var service = function(query, queryOptions){
var dfd = new dojo.Deferred();
var results = [];
// TODO: generate your results array here - it should look like your GET response
results = [
{
id: 'item1'
},
{
new dijit.form.ComboBox({
store: new dojo.data.ItemFileReadStore({
data: cityJson
}),
autoComplete: true,
query: {
state: "*"
},
style: "width: 150px;",
required: true,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.2/dojo/resources/dojo.css";
</style>
<script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/dojo/1.2/dojo/dojo.xd.js'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.2/dojo/resources/dojo.css";
</style>
<script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/dojo/1.2/dojo/dojo.xd.js'
<script type="text/javascript">
dojo.require("dojo.data.ItemFileWriteStore");
var fillStore = function(){
dojo.xhrGet({
url: "some/url",
handleAs: "json",
load: function(data, ioArgs){
// handle your data here
}