MCPcopy Index your code
hub / github.com/caike/jQuery-Simple-Timer / on

Function on

examples/bundle.js:5035–5094  ·  view source on GitHub ↗
( elem, types, selector, data, fn, one )

Source from the content-addressed store, hash-verified

5033}
5034
5035function on( elem, types, selector, data, fn, one ) {
5036 var origFn, type;
5037
5038 // Types can be a map of types/handlers
5039 if ( typeof types === "object" ) {
5040
5041 // ( types-Object, selector, data )
5042 if ( typeof selector !== "string" ) {
5043
5044 // ( types-Object, data )
5045 data = data || selector;
5046 selector = undefined;
5047 }
5048 for ( type in types ) {
5049 on( elem, type, selector, data, types[ type ], one );
5050 }
5051 return elem;
5052 }
5053
5054 if ( data == null && fn == null ) {
5055
5056 // ( types, fn )
5057 fn = selector;
5058 data = selector = undefined;
5059 } else if ( fn == null ) {
5060 if ( typeof selector === "string" ) {
5061
5062 // ( types, selector, fn )
5063 fn = data;
5064 data = undefined;
5065 } else {
5066
5067 // ( types, data, fn )
5068 fn = data;
5069 data = selector;
5070 selector = undefined;
5071 }
5072 }
5073 if ( fn === false ) {
5074 fn = returnFalse;
5075 } else if ( !fn ) {
5076 return elem;
5077 }
5078
5079 if ( one === 1 ) {
5080 origFn = fn;
5081 fn = function( event ) {
5082
5083 // Can use an empty set, since event contains the info
5084 jQuery().off( event );
5085 return origFn.apply( this, arguments );
5086 };
5087
5088 // Use same guid so caller can remove using origFn
5089 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
5090 }
5091 return elem.each( function() {
5092 jQuery.event.add( this, types, fn, data, selector );

Callers 1

bundle.jsFile · 0.70

Calls 1

jQueryFunction · 0.85

Tested by

no test coverage detected