File tree Expand file tree Collapse file tree 1 file changed +10
-28
lines changed Expand file tree Collapse file tree 1 file changed +10
-28
lines changed Original file line number Diff line number Diff line change @@ -189,34 +189,16 @@ const parseMessage = message => {
189
189
}
190
190
} ;
191
191
192
- // Stolen from https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred
193
- function Deferred ( ) {
194
- /* A method to resolve the associated Promise with the value passed.
195
- * If the promise is already settled it does nothing.
196
- *
197
- * @param {anything } value : This value is used to resolve the promise
198
- * If the value is a Promise then the associated promise assumes the state
199
- * of Promise passed as value.
200
- */
201
- this . resolve = null ;
202
-
203
- /* A method to reject the assocaited Promise with the value passed.
204
- * If the promise is already settled it does nothing.
205
- *
206
- * @param {anything } reason: The reason for the rejection of the Promise.
207
- * Generally its an Error object. If however a Promise is passed, then the Promise
208
- * itself will be the reason for rejection no matter the state of the Promise.
209
- */
210
- this . reject = null ;
211
-
212
- /* A newly created Promise object.
213
- * Initially in pending state.
214
- */
215
- this . promise = new Promise ( ( resolve , reject ) => {
216
- this . resolve = resolve ;
217
- this . reject = reject ;
218
- } ) ;
219
-
192
+ // Deferred class maps the old way for declaring promises
193
+ class Deferred {
194
+ constructor ( ) {
195
+ this . resolve = null ;
196
+ this . reject = null ;
197
+ this . promise = new Promise ( ( resolve , reject ) => {
198
+ this . resolve = resolve ;
199
+ this . reject = reject ;
200
+ } ) ;
201
+ }
220
202
}
221
203
222
204
const perform = ( action , data , cb ) => {
You can’t perform that action at this time.
0 commit comments