(events)
| 48 | return promise; |
| 49 | } |
| 50 | trigger(events) { |
| 51 | var event, node, calls, tail, args, all, rest; |
| 52 | if (!(calls = this._callbacks)) { |
| 53 | return this; |
| 54 | } |
| 55 | all = calls.all; |
| 56 | events = events.split(eventSplitter); |
| 57 | rest = slice.call(arguments, 1); |
| 58 | |
| 59 | // For each event, walk through the linked list of callbacks twice, |
| 60 | // first to trigger the event, then to trigger any `"all"` callbacks. |
| 61 | event = events.shift(); |
| 62 | while (event) { |
| 63 | node = calls[event]; |
| 64 | if (node) { |
| 65 | tail = node.tail; |
| 66 | while ((node = node.next) !== tail) { |
| 67 | node.callback.apply(node.context || this, rest); |
| 68 | } |
| 69 | } |
| 70 | node = all; |
| 71 | if (node) { |
| 72 | tail = node.tail; |
| 73 | args = [event].concat(rest); |
| 74 | while ((node = node.next) !== tail) { |
| 75 | node.callback.apply(node.context || this, args); |
| 76 | } |
| 77 | } |
| 78 | event = events.shift(); |
| 79 | } |
| 80 | |
| 81 | return this; |
| 82 | } |
| 83 | Promise(){ |
| 84 | var resolve, reject; |
| 85 | var promise = new Promise_BlueBird(function() { |
no outgoing calls
no test coverage detected