This file contains 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
dojox.Promise = function(){ | |
return { | |
emit: function(data){ // stub function | |
}, | |
then: function(doneHandler,errHandler){ | |
var promise = new dojox.Promise(); | |
dojo.connect(this, 'emit', function(data){ | |
if(doneHandler && !(data instanceof Error)){ |
This file contains 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
// DOM node creation quick'n'easy: | |
var containerNode = embed.create('div', { | |
className: 'container box', | |
innerHTML: '<span>Huh, a container!</span>', | |
style: { | |
border: 'solid red 1px' | |
} | |
}, parentNode); |
This file contains 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
define(['feature!async-promise'],function(embed){ | |
// Now you have embed.Promise available! | |
}) | |
// All features return the same object, so that you | |
// can do the following: | |
define(['feature!async-promise', 'feature!html-element'], function(embed){ | |
// All methods provided by the html-element feature are now | |
// available in the object returned by the async-promise feature, |
This file contains 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
<script> | |
var require = { | |
baseUrl: 'src/', // all other paths are now relative to this one | |
paths: { | |
'implementations': 'platforms/unknown' | |
} | |
}; | |
</script> | |
<script type="text/javascript" src="src/require.js"></script> |
This file contains 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>IDBWrapper Tutorial, Step 1</title> | |
</head> | |
<body> | |
<script type="text/javascript" src="IDBStore.js"></script> | |
<script type="text/javascript" src="tutorial.js"></script> | |
</body> | |
</html> |
This file contains 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
var dude = { | |
firstname: 'John', | |
lastname: 'Doe', | |
age: 52, | |
emails: [ | |
'[email protected]', | |
'[email protected]' | |
] | |
}; |
This file contains 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
var id = 1; // Or whatever you got returned. | |
var onsuccess = function(data){ | |
console.log('here is our dude:', data); | |
} | |
var onerror = function(error){ | |
console.log('Oh noes, sth went wrong!', error); | |
} | |
customers.get(id, onsuccess, onerror); |
This file contains 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
var updatedDude = { | |
id: 1, // or whatever id our dude has | |
firstname: 'John', | |
lastname: 'Doe', | |
age: 53, // dude is now a year older | |
emails: [ | |
'[email protected]', | |
'[email protected]' | |
] | |
}; |
This file contains 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
var onsuccess = function(data){ | |
console.log('Here is what we have in store ('+data.length+' items in total):'); | |
data.forEach(function(item){ | |
console.log(item); | |
}); | |
} | |
var onerror = function(error){ | |
console.log('Oh noes, sth went wrong!', error); | |
} |
This file contains 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
var id = 1; | |
var onsuccess = function(result){ | |
if(result !== false){ | |
console.log('deletion successful!'); | |
} | |
} | |
var onerror = function(error){ | |
console.log('Oh noes, sth went wrong!', error); | |
} |
OlderNewer