lib/require.js
function() {
			if (this.events) { return; }

			var tag		= this.tag,
				script	= this,
				prefix	= '',
				method	= 'addEventListener';

			// The alternative is nuking Redmond from orbit, its the only way to
			// be sure...
			if (!tag.addEventListener) {
				prefix = 'on';
				method = 'attachEvent';
			}

			function loaded(event) {
				script.onload();
			}

			function failed(event) {
				script.onfail();
			}

			function state(event) {
				switch(tag.readyState) {
					case 'complete':	return loaded(event);
					case 'error':		return failed(event);
				}
			}

			if (prefix === '') {
				tag[method](prefix + 'error', failed);
				tag[method](prefix + 'load', loaded);
			}else{
				tag[method](prefix + 'readystatechange', state);
			}

			this.events = {
				loaded:	loaded,
				failed:	failed,
				state:	state
			};

			return this;
		}
function() {
			if (this.events) { return; }

			var tag		= this.tag,
				script	= this,
				prefix	= '',
				method	= 'addEventListener';

			// The alternative is nuking Redmond from orbit, its the only way to
			// be sure...
			if (!tag.addEventListener) {
				prefix = 'on';
				method = 'attachEvent';
			}

			function loaded(event) {
				script.onload();
			}

			function failed(event) {
				script.onfail();
			}

			function state(event) {
				switch(tag.readyState) {
					case 'complete':	return loaded(event);
					case 'error':		return failed(event);
				}
			}

			if (prefix === '') {
				tag[method](prefix + 'error', failed);
				tag[method](prefix + 'load', loaded);
			}else{
				tag[method](prefix + 'readystatechange', state);
			}

			this.events = {
				loaded:	loaded,
				failed:	failed,
				state:	state
			};

			return this;
		}
function ( ) { if ( this . events ) { return ; } var tag = this . tag , script = this , prefix = '' , method = 'addEventListener' ; // The alternative is nuking Redmond from orbit, its the only way to
 // be sure...
 if ( ! tag . addEventListener ) { prefix = 'on' ; method = 'attachEvent' ; } function loaded ( event ) { script . onload ( ) ; } function failed ( event ) { script . onfail ( ) ; } function state ( event ) { switch ( tag . readyState ) { case 'complete' : return loaded ( event ) ; case 'error' : return failed ( event ) ; } } if ( prefix === '' ) { tag [ method ] ( prefix + 'error' , failed ) ; tag [ method ] ( prefix + 'load' , loaded ) ; } else { tag [ method ] ( prefix + 'readystatechange' , state ) ; } this . events = { loaded : loaded , failed : failed , state : state } ; return this ; }
Bind events to indicate success, or failure, of loading this `Script` instance.
Bind events to indicate success or failure of loading this Script instance .