Created
January 18, 2011 16:10
-
-
Save rmurphey/784656 to your computer and use it in GitHub Desktop.
Dojo Snipmate Snippets
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
# array utils | |
snippet dfe | |
dojo.forEach(${1:array}, function(${2:item}) { | |
${3} | |
}${3:, this}); | |
snippet dmap | |
dojo.map(${1:array}, function(${2:item}) { | |
${4} | |
}${3:, this}); | |
snippet dfilter | |
dojo.filter(${1:array}, function(${2:item}) { | |
${4} | |
}${3:, this}); | |
snippet dsome | |
dojo.some(${1:array}, function(${2:item}) { | |
${4} | |
}${3:, this}); | |
snippet devery | |
dojo.every(${1:array}, function(${2:item}) { | |
${4} | |
}${3:, this}); | |
# stuff with elements | |
snippet dq | |
dojo.query('${1:selector}'${2:, context}); | |
snippet dbody | |
dojo.body(); | |
snippet dbyid | |
dojo.byId('${1}'); | |
snippet dd | |
dojo.destroy(${1:elementToDestroy}); | |
snippet dcr | |
dojo.create('${1}'${2:, attributes}); | |
snippet dp | |
dojo.place(${1}, ${2:destinationNode}${3:, position}); | |
## adding and removing classes | |
snippet dac | |
dojo.addClass(${1:node}, '${2:className}'); | |
snippet drc | |
dojo.removeClass(${1:node}, '${2:className}'); | |
snippet dcondc | |
dojo[${1} ? 'addClass' : 'removeClass'](${2:node}, '${3:className}'); | |
# connection stuff | |
snippet dpub | |
dojo.publish('${1:topic}', [ ${2:data} ]); | |
snippet dsub | |
dojo.subscribe('${1:topic}', ${2:handler}); | |
snippet dsubc | |
dojo.subscribe('${1:topic}', ${2:scope}, ${3:handlerMethodNameOrFunction}); | |
snippet dcon | |
dojo.connect(${1:nodeOrObject}, '${2:methodOrEvent}', ${3:scope, }${4:handler}); | |
# modules & stuff | |
snippet ddeclare | |
dojo.declare('${1:className}', [${2:dependencies}], { | |
${3:prototype} | |
}); | |
snippet dmod | |
dojo.provide('${1:moduleName}'); | |
dojo.declare('$1', [${2:dependencies}], { | |
${3:prototype} | |
}); | |
snippet dtw | |
dojo.provide('${1:moduleName}'); | |
dojo.require('dijit._Widget'); | |
dojo.require('dijit._Templated'); | |
dojo.declare('$1', [ dijit._Widget, dijit._Templated ], { | |
templateString : ${2}, | |
${3:widgetsInTemplate : true, } | |
postCreate : function() { | |
${4} | |
} | |
}); | |
snippet dreq | |
dojo.require('${1}'); | |
snippet dti | |
this.inherited(arguments); | |
snippet dh | |
dojo.hitch(${1:this}, ${2:/* method name or function */}${3:, additionalArgs}); | |
snippet dha | |
dojo.hitch(this, function(${1}) { | |
${2} | |
}); | |
snippet dhn | |
dojo.hitch(this, '${1}'); | |
snippet dca | |
dojo.cache(${1:namespace}, ${2:fileLocation}); | |
snippet dm | |
dojo.mixin(${1:\{\}}, ${2}); | |
snippet dra | |
dojo.ready(function() { | |
${1} | |
}); | |
snippet drf | |
dojo.ready(${1}); | |
snippet danim | |
dojo.anim( | |
${1:node}, | |
{ | |
${2:properties} | |
}, | |
${3:duration}${4:, \n${5:easing}${6:, onEnd}${7:, delay}} | |
); | |
snippet dw | |
dojo.when(${1}, ${2:successFn}${3:, failFn}); | |
# xhr | |
snippet dxg | |
dojo.xhrGet({ | |
url : ${1}, | |
handleAs : '${2}' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment