Skip to content

@victusfate /working_member_bind.coffee
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
working CoffeeScript class member bind
class GameOfLife
#rest of class omitted
#see http://github.com/victusfate/life
update: (playpause=1) ->
#jk dual flip flop flashback
if playpause == @playpause
@playpause = 0
clearTimeout @time_out_id if @time_out_id 
else
@playpause = 1
# guts of method omitted
if @playpause > 0
@time_out_id = setTimeout( =>
@update(2)
500)
return
window.GameOfLife = GameOfLife
var GameOfLife;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
GameOfLife = (function() {
function GameOfLife() {}
GameOfLife.prototype.update = function(playpause) {
if (playpause == null) {
playpause = 1;
}
if (playpause === this.playpause) {
this.playpause = 0;
if (this.time_out_id ) {
clearTimeout(this.time_out_id);
}
} else {
this.playpause = 1;
}
if (this.playpause > 0) {
this.time_out_id = setTimeout(__bind(function() {
this.update(2);
return 500;
}, this));
}
};
return GameOfLife;
})();
window.GameOfLife = GameOfLife;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.