Skip to content

Instantly share code, notes, and snippets.

@mzgoddard
Created May 10, 2012 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzgoddard/2654040 to your computer and use it in GitHub Desktop.
Save mzgoddard/2654040 to your computer and use it in GitHub Desktop.
Fat Arrow Funcs
// engine/object.js
this.task( () => {
var index = this.objects.indexOf( object );
if ( index != -1 ) {
if ( object.ongamedestroy )
object.ongamedestroy( this );
object.call( 'ongamedestroy', object, this );
object.game = null;
this.objects.splice( index, 1 );
}
}, Game.Priorities.GARBAGE, false, true );
// load.js
img.onload = () => {
this.objects[ path ] = img;
deferred.resolve( img );
};
img.onerror = () => {
deferred.reject();
};
// game/glider.js
when(
load.text( 'locale/en/tricks.json' ),
( text ) => {
this.titles = JSON.parse( text );
} );
// game/level.js
promise = load.package( def );
promise.then( () => {
this.def = load.get( def );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment