1/* masalygin 0.0.1 */ 2'use strict'; 3 4(function(factory) { 5 6 if (typeof define === 'function' && define.amd) { 7 8 define(['jquery'], factory); 9 10 } else { 11 12 factory(jQuery); 13 14 } 15 16})(function($) { 17 18 $.s3Eventable = function(obj) { 19 20 obj = obj || {}; 21 obj._events = {}; 22 obj._lock = false; 23 24 obj.on = function(type, func) { 25 26 if (!obj._lock) { 27 28 if ($.type(type) === 'object') { 29 30 $.each(type, function(key, value) { 31 obj.on(key, value); 32 }); 33 34 return this; 35 } 36 37 if (!this._events[type]) { 38 this._events[type] = $.Callbacks(); 39 } 40 41 this._events[type].add(func); 42 43 } 44 45 return this; 46 }; 47 48 obj.off = function(type, func) { 49 50 if (this._events[type] && !obj._lock) { 51 func ? this._events[type].remove(func) : this._events[type].empty(); 52 } 53 54 return this; 55 }; 56 57 obj.trigger = function(type) { 58 if (this._events[type]) { 59 this._events[type].fireWith(obj, [].slice.call(arguments, 1)); 60 } 61 return this; 62 }; 63 64 obj.lock = function() { 65 obj._lock = true; 66 }; 67 68 obj.unlock = function() { 69 obj._lock = false; 70 }; 71 72 return obj; 73 74 }; 75 76});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.