All pastes #956259 Raw Edit

Thread

public javascript v1 · immutable
#956259 ·published 2008-03-25 03:33 UTC
rendered paste body
function Thread(run){	this.run = run;		// Similar to using Prototype's "bind" function	// i.e. start = this.start.bind(this);		var start = this.start;		this.start = function(){		start.apply(self, arguments);	};}Thread.prototype = {	run: function() {		return true;	},	start: function() {		this._stop = false;		if (!this._stop && !this.run())			setTimeout(this.start, 0);		return this;	},	stop: function() {		this._stop = true;		return this;	}};