MCPcopy Create free account
hub / github.com/JsAaron/jQuery / fire

Function fire

2.0.3/Callbacks.js:72–102  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

70
71 // Fire callbacks// 触发回调函数列表
72 fire = function(data) {
73 //如果参数memory为true,则记录data
74 memory = options.memory && data;
75 fired = true; //标记触发回调
76 firingIndex = firingStart || 0;
77 firingStart = 0;
78 firingLength = list.length;
79 //标记正在触发回调
80 firing = true;
81 for (; list && firingIndex < firingLength; firingIndex++) {
82 if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
83 // 阻止未来可能由于add所产生的回调
84 memory = false; // To prevent further calls using add
85 break; //由于参数stopOnFalse为true,所以当有回调函数返回值为false时退出循环
86 }
87 }
88 //标记回调结束
89 firing = false;
90 if (list) {
91 if (stack) {
92 if (stack.length) {
93 //从堆栈头部取出,递归fire
94 fire(stack.shift());
95 }
96 } else if (memory) { //否则,如果有记忆
97 list = [];
98 } else { //再否则阻止回调列表中的回调
99 self.disable();
100 }
101 }
102 },
103 // Actual Callbacks object
104 // 暴露在外的Callbacks对象,对外接口
105 self = {

Callers 1

Callbacks.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected