Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rsvp.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
rsvp.js
Commits
cde40f5c
Commit
cde40f5c
authored
May 18, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Publish build version of rsvp.
parent
b2adfc96
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
187 deletions
+37
-187
dist/commonjs/rsvp/all.js
dist/commonjs/rsvp/all.js
+2
-8
dist/commonjs/rsvp/async.js
dist/commonjs/rsvp/async.js
+3
-3
dist/commonjs/rsvp/promise.js
dist/commonjs/rsvp/promise.js
+2
-38
dist/commonjs/rsvp/queue.js
dist/commonjs/rsvp/queue.js
+5
-13
dist/rsvp-2.0.4.amd.js
dist/rsvp-2.0.4.amd.js
+12
-62
dist/rsvp-2.0.4.js
dist/rsvp-2.0.4.js
+12
-62
dist/rsvp-2.0.4.min.js
dist/rsvp-2.0.4.min.js
+1
-1
No files found.
dist/commonjs/rsvp/all.js
View file @
cde40f5c
...
@@ -20,7 +20,7 @@ function promiseAtLeast(expected_count, promises) {
...
@@ -20,7 +20,7 @@ function promiseAtLeast(expected_count, promises) {
}
}
}
}
return
new
Promise
(
function
(
resolve
,
reject
,
notify
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
results
=
[],
remaining
=
promises
.
length
,
var
results
=
[],
remaining
=
promises
.
length
,
promise
,
remaining_count
=
promises
.
length
-
expected_count
;
promise
,
remaining_count
=
promises
.
length
-
expected_count
;
...
@@ -50,12 +50,6 @@ function promiseAtLeast(expected_count, promises) {
...
@@ -50,12 +50,6 @@ function promiseAtLeast(expected_count, promises) {
}
}
}
}
function
notifier
(
index
)
{
return
function
(
value
)
{
notify
({
"
index
"
:
index
,
"
value
"
:
value
});
};
}
function
cancelAll
(
rejectionValue
)
{
function
cancelAll
(
rejectionValue
)
{
reject
(
rejectionValue
);
reject
(
rejectionValue
);
canceller
();
canceller
();
...
@@ -65,7 +59,7 @@ function promiseAtLeast(expected_count, promises) {
...
@@ -65,7 +59,7 @@ function promiseAtLeast(expected_count, promises) {
promise
=
promises
[
i
];
promise
=
promises
[
i
];
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
promise
.
then
(
resolver
(
i
),
cancelAll
,
notifier
(
i
)
);
promise
.
then
(
resolver
(
i
),
cancelAll
);
}
else
{
}
else
{
resolveAll
(
i
,
promise
);
resolveAll
(
i
,
promise
);
}
}
...
...
dist/commonjs/rsvp/async.js
View file @
cde40f5c
...
@@ -82,14 +82,14 @@ function useSetTimeout() {
...
@@ -82,14 +82,14 @@ function useSetTimeout() {
};
};
}
}
if
(
typeof
setImmediate
===
'
function
'
)
{
if
(
checkNativePromise
())
{
async
=
useNativePromise
();
}
else
if
(
typeof
setImmediate
===
'
function
'
)
{
async
=
useSetImmediate
();
async
=
useSetImmediate
();
}
else
if
(
typeof
process
!==
'
undefined
'
&&
{}.
toString
.
call
(
process
)
===
'
[object process]
'
)
{
}
else
if
(
typeof
process
!==
'
undefined
'
&&
{}.
toString
.
call
(
process
)
===
'
[object process]
'
)
{
async
=
useNextTick
();
async
=
useNextTick
();
}
else
if
(
BrowserMutationObserver
)
{
}
else
if
(
BrowserMutationObserver
)
{
async
=
useMutationObserver
();
async
=
useMutationObserver
();
}
else
if
(
checkNativePromise
())
{
async
=
useNativePromise
();
}
else
{
}
else
{
async
=
useSetTimeout
();
async
=
useSetTimeout
();
}
}
...
...
dist/commonjs/rsvp/promise.js
View file @
cde40f5c
...
@@ -40,11 +40,6 @@ var Promise = function(resolver, canceller) {
...
@@ -40,11 +40,6 @@ var Promise = function(resolver, canceller) {
reject
(
promise
,
value
);
reject
(
promise
,
value
);
};
};
var
notifyPromise
=
function
(
value
)
{
if
(
resolved
)
{
return
;
}
notify
(
promise
,
value
);
};
this
.
on
(
'
promise:failed
'
,
function
(
event
)
{
this
.
on
(
'
promise:failed
'
,
function
(
event
)
{
this
.
trigger
(
'
error
'
,
{
detail
:
event
.
detail
});
this
.
trigger
(
'
error
'
,
{
detail
:
event
.
detail
});
},
this
);
},
this
);
...
@@ -68,7 +63,7 @@ var Promise = function(resolver, canceller) {
...
@@ -68,7 +63,7 @@ var Promise = function(resolver, canceller) {
};
};
try
{
try
{
resolver
(
resolvePromise
,
rejectPromise
,
notifyPromise
);
resolver
(
resolvePromise
,
rejectPromise
);
}
catch
(
e
)
{
}
catch
(
e
)
{
rejectPromise
(
e
);
rejectPromise
(
e
);
}
}
...
@@ -113,22 +108,6 @@ var invokeCallback = function(type, promise, callback, event) {
...
@@ -113,22 +108,6 @@ var invokeCallback = function(type, promise, callback, event) {
}
}
};
};
var
invokeNotifyCallback
=
function
(
promise
,
callback
,
event
)
{
var
value
;
if
(
typeof
callback
===
'
function
'
)
{
try
{
value
=
callback
(
event
.
detail
);
}
catch
(
e
)
{
// stop propagating
return
;
}
notify
(
promise
,
value
);
}
else
{
notify
(
promise
,
event
.
detail
);
}
};
Promise
.
prototype
=
{
Promise
.
prototype
=
{
constructor
:
Promise
,
constructor
:
Promise
,
...
@@ -137,7 +116,7 @@ Promise.prototype = {
...
@@ -137,7 +116,7 @@ Promise.prototype = {
rejectedReason
:
undefined
,
rejectedReason
:
undefined
,
fulfillmentValue
:
undefined
,
fulfillmentValue
:
undefined
,
then
:
function
(
done
,
fail
,
progress
)
{
then
:
function
(
done
,
fail
)
{
this
.
off
(
'
error
'
,
onerror
);
this
.
off
(
'
error
'
,
onerror
);
var
thenPromise
=
new
this
.
constructor
(
function
()
{},
var
thenPromise
=
new
this
.
constructor
(
function
()
{},
...
@@ -165,10 +144,6 @@ Promise.prototype = {
...
@@ -165,10 +144,6 @@ Promise.prototype = {
invokeCallback
(
'
reject
'
,
thenPromise
,
fail
,
event
);
invokeCallback
(
'
reject
'
,
thenPromise
,
fail
,
event
);
});
});
this
.
on
(
'
promise:notified
'
,
function
(
event
)
{
invokeNotifyCallback
(
thenPromise
,
progress
,
event
);
});
return
thenPromise
;
return
thenPromise
;
},
},
...
@@ -204,11 +179,6 @@ function handleThenable(promise, value) {
...
@@ -204,11 +179,6 @@ function handleThenable(promise, value) {
then
=
value
.
then
;
then
=
value
.
then
;
if
(
isFunction
(
then
))
{
if
(
isFunction
(
then
))
{
if
(
isFunction
(
value
.
on
))
{
value
.
on
(
'
promise:notified
'
,
function
(
event
)
{
notify
(
promise
,
event
.
detail
);
});
}
promise
.
on
(
'
promise:cancelled
'
,
function
(
event
)
{
promise
.
on
(
'
promise:cancelled
'
,
function
(
event
)
{
if
(
isFunction
(
value
.
cancel
))
{
if
(
isFunction
(
value
.
cancel
))
{
value
.
cancel
();
value
.
cancel
();
...
@@ -261,11 +231,5 @@ function reject(promise, value) {
...
@@ -261,11 +231,5 @@ function reject(promise, value) {
});
});
}
}
function
notify
(
promise
,
value
)
{
config
.
async
(
function
()
{
promise
.
trigger
(
'
promise:notified
'
,
{
detail
:
value
});
});
}
exports
.
Promise
=
Promise
;
exports
.
Promise
=
Promise
;
\ No newline at end of file
dist/commonjs/rsvp/queue.js
View file @
cde40f5c
...
@@ -19,7 +19,6 @@ var Queue = function() {
...
@@ -19,7 +19,6 @@ var Queue = function() {
promise
,
promise
,
fulfill
,
fulfill
,
reject
,
reject
,
notify
,
resolved
;
resolved
;
if
(
!
(
this
instanceof
Queue
))
{
if
(
!
(
this
instanceof
Queue
))
{
...
@@ -32,7 +31,7 @@ var Queue = function() {
...
@@ -32,7 +31,7 @@ var Queue = function() {
}
}
}
}
promise
=
new
Promise
(
function
(
done
,
fail
,
progress
)
{
promise
=
new
Promise
(
function
(
done
,
fail
)
{
fulfill
=
function
(
fulfillmentValue
)
{
fulfill
=
function
(
fulfillmentValue
)
{
if
(
resolved
)
{
return
;}
if
(
resolved
)
{
return
;}
queue
.
isFulfilled
=
true
;
queue
.
isFulfilled
=
true
;
...
@@ -47,7 +46,6 @@ var Queue = function() {
...
@@ -47,7 +46,6 @@ var Queue = function() {
resolved
=
true
;
resolved
=
true
;
return
fail
(
rejectedReason
);
return
fail
(
rejectedReason
);
};
};
notify
=
progress
;
},
canceller
);
},
canceller
);
promise_list
.
push
(
resolve
());
promise_list
.
push
(
resolve
());
...
@@ -71,7 +69,7 @@ var Queue = function() {
...
@@ -71,7 +69,7 @@ var Queue = function() {
return
promise
.
then
.
apply
(
promise
,
arguments
);
return
promise
.
then
.
apply
(
promise
,
arguments
);
};
};
queue
.
push
=
function
(
done
,
fail
,
progress
)
{
queue
.
push
=
function
(
done
,
fail
)
{
var
last_promise
=
promise_list
[
promise_list
.
length
-
1
],
var
last_promise
=
promise_list
[
promise_list
.
length
-
1
],
next_promise
;
next_promise
;
...
@@ -79,11 +77,11 @@ var Queue = function() {
...
@@ -79,11 +77,11 @@ var Queue = function() {
throw
new
ResolvedQueueError
();
throw
new
ResolvedQueueError
();
}
}
next_promise
=
last_promise
.
then
(
done
,
fail
,
progress
);
next_promise
=
last_promise
.
then
(
done
,
fail
);
promise_list
.
push
(
next_promise
);
promise_list
.
push
(
next_promise
);
// Handle pop
// Handle pop
last_promise
=
next_promise
.
then
(
function
(
fulfillmentValue
)
{
promise_list
.
push
(
next_promise
.
then
(
function
(
fulfillmentValue
)
{
promise_list
.
splice
(
0
,
2
);
promise_list
.
splice
(
0
,
2
);
if
(
promise_list
.
length
===
0
)
{
if
(
promise_list
.
length
===
0
)
{
fulfill
(
fulfillmentValue
);
fulfill
(
fulfillmentValue
);
...
@@ -97,13 +95,7 @@ var Queue = function() {
...
@@ -97,13 +95,7 @@ var Queue = function() {
}
else
{
}
else
{
throw
rejectedReason
;
throw
rejectedReason
;
}
}
},
function
(
notificationValue
)
{
}));
if
(
promise_list
[
promise_list
.
length
-
1
]
===
last_promise
)
{
notify
(
notificationValue
);
}
return
notificationValue
;
});
promise_list
.
push
(
last_promise
);
return
this
;
return
this
;
};
};
...
...
dist/rsvp-2.0.4.amd.js
View file @
cde40f5c
...
@@ -23,7 +23,7 @@ define("rsvp/all",
...
@@ -23,7 +23,7 @@ define("rsvp/all",
}
}
}
}
return
new
Promise
(
function
(
resolve
,
reject
,
notify
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
results
=
[],
remaining
=
promises
.
length
,
var
results
=
[],
remaining
=
promises
.
length
,
promise
,
remaining_count
=
promises
.
length
-
expected_count
;
promise
,
remaining_count
=
promises
.
length
-
expected_count
;
...
@@ -53,12 +53,6 @@ define("rsvp/all",
...
@@ -53,12 +53,6 @@ define("rsvp/all",
}
}
}
}
function
notifier
(
index
)
{
return
function
(
value
)
{
notify
({
"
index
"
:
index
,
"
value
"
:
value
});
};
}
function
cancelAll
(
rejectionValue
)
{
function
cancelAll
(
rejectionValue
)
{
reject
(
rejectionValue
);
reject
(
rejectionValue
);
canceller
();
canceller
();
...
@@ -68,7 +62,7 @@ define("rsvp/all",
...
@@ -68,7 +62,7 @@ define("rsvp/all",
promise
=
promises
[
i
];
promise
=
promises
[
i
];
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
promise
.
then
(
resolver
(
i
),
cancelAll
,
notifier
(
i
)
);
promise
.
then
(
resolver
(
i
),
cancelAll
);
}
else
{
}
else
{
resolveAll
(
i
,
promise
);
resolveAll
(
i
,
promise
);
}
}
...
@@ -176,14 +170,14 @@ define("rsvp/async",
...
@@ -176,14 +170,14 @@ define("rsvp/async",
};
};
}
}
if
(
typeof
setImmediate
===
'
function
'
)
{
if
(
checkNativePromise
())
{
async
=
useNativePromise
();
}
else
if
(
typeof
setImmediate
===
'
function
'
)
{
async
=
useSetImmediate
();
async
=
useSetImmediate
();
}
else
if
(
typeof
process
!==
'
undefined
'
&&
{}.
toString
.
call
(
process
)
===
'
[object process]
'
)
{
}
else
if
(
typeof
process
!==
'
undefined
'
&&
{}.
toString
.
call
(
process
)
===
'
[object process]
'
)
{
async
=
useNextTick
();
async
=
useNextTick
();
}
else
if
(
BrowserMutationObserver
)
{
}
else
if
(
BrowserMutationObserver
)
{
async
=
useMutationObserver
();
async
=
useMutationObserver
();
}
else
if
(
checkNativePromise
())
{
async
=
useNativePromise
();
}
else
{
}
else
{
async
=
useSetTimeout
();
async
=
useSetTimeout
();
}
}
...
@@ -492,11 +486,6 @@ define("rsvp/promise",
...
@@ -492,11 +486,6 @@ define("rsvp/promise",
reject
(
promise
,
value
);
reject
(
promise
,
value
);
};
};
var
notifyPromise
=
function
(
value
)
{
if
(
resolved
)
{
return
;
}
notify
(
promise
,
value
);
};
this
.
on
(
'
promise:failed
'
,
function
(
event
)
{
this
.
on
(
'
promise:failed
'
,
function
(
event
)
{
this
.
trigger
(
'
error
'
,
{
detail
:
event
.
detail
});
this
.
trigger
(
'
error
'
,
{
detail
:
event
.
detail
});
},
this
);
},
this
);
...
@@ -520,7 +509,7 @@ define("rsvp/promise",
...
@@ -520,7 +509,7 @@ define("rsvp/promise",
};
};
try
{
try
{
resolver
(
resolvePromise
,
rejectPromise
,
notifyPromise
);
resolver
(
resolvePromise
,
rejectPromise
);
}
catch
(
e
)
{
}
catch
(
e
)
{
rejectPromise
(
e
);
rejectPromise
(
e
);
}
}
...
@@ -565,22 +554,6 @@ define("rsvp/promise",
...
@@ -565,22 +554,6 @@ define("rsvp/promise",
}
}
};
};
var
invokeNotifyCallback
=
function
(
promise
,
callback
,
event
)
{
var
value
;
if
(
typeof
callback
===
'
function
'
)
{
try
{
value
=
callback
(
event
.
detail
);
}
catch
(
e
)
{
// stop propagating
return
;
}
notify
(
promise
,
value
);
}
else
{
notify
(
promise
,
event
.
detail
);
}
};
Promise
.
prototype
=
{
Promise
.
prototype
=
{
constructor
:
Promise
,
constructor
:
Promise
,
...
@@ -589,7 +562,7 @@ define("rsvp/promise",
...
@@ -589,7 +562,7 @@ define("rsvp/promise",
rejectedReason
:
undefined
,
rejectedReason
:
undefined
,
fulfillmentValue
:
undefined
,
fulfillmentValue
:
undefined
,
then
:
function
(
done
,
fail
,
progress
)
{
then
:
function
(
done
,
fail
)
{
this
.
off
(
'
error
'
,
onerror
);
this
.
off
(
'
error
'
,
onerror
);
var
thenPromise
=
new
this
.
constructor
(
function
()
{},
var
thenPromise
=
new
this
.
constructor
(
function
()
{},
...
@@ -617,10 +590,6 @@ define("rsvp/promise",
...
@@ -617,10 +590,6 @@ define("rsvp/promise",
invokeCallback
(
'
reject
'
,
thenPromise
,
fail
,
event
);
invokeCallback
(
'
reject
'
,
thenPromise
,
fail
,
event
);
});
});
this
.
on
(
'
promise:notified
'
,
function
(
event
)
{
invokeNotifyCallback
(
thenPromise
,
progress
,
event
);
});
return
thenPromise
;
return
thenPromise
;
},
},
...
@@ -656,11 +625,6 @@ define("rsvp/promise",
...
@@ -656,11 +625,6 @@ define("rsvp/promise",
then
=
value
.
then
;
then
=
value
.
then
;
if
(
isFunction
(
then
))
{
if
(
isFunction
(
then
))
{
if
(
isFunction
(
value
.
on
))
{
value
.
on
(
'
promise:notified
'
,
function
(
event
)
{
notify
(
promise
,
event
.
detail
);
});
}
promise
.
on
(
'
promise:cancelled
'
,
function
(
event
)
{
promise
.
on
(
'
promise:cancelled
'
,
function
(
event
)
{
if
(
isFunction
(
value
.
cancel
))
{
if
(
isFunction
(
value
.
cancel
))
{
value
.
cancel
();
value
.
cancel
();
...
@@ -713,12 +677,6 @@ define("rsvp/promise",
...
@@ -713,12 +677,6 @@ define("rsvp/promise",
});
});
}
}
function
notify
(
promise
,
value
)
{
config
.
async
(
function
()
{
promise
.
trigger
(
'
promise:notified
'
,
{
detail
:
value
});
});
}
__exports__
.
Promise
=
Promise
;
__exports__
.
Promise
=
Promise
;
});
});
...
@@ -746,7 +704,6 @@ define("rsvp/queue",
...
@@ -746,7 +704,6 @@ define("rsvp/queue",
promise
,
promise
,
fulfill
,
fulfill
,
reject
,
reject
,
notify
,
resolved
;
resolved
;
if
(
!
(
this
instanceof
Queue
))
{
if
(
!
(
this
instanceof
Queue
))
{
...
@@ -759,7 +716,7 @@ define("rsvp/queue",
...
@@ -759,7 +716,7 @@ define("rsvp/queue",
}
}
}
}
promise
=
new
Promise
(
function
(
done
,
fail
,
progress
)
{
promise
=
new
Promise
(
function
(
done
,
fail
)
{
fulfill
=
function
(
fulfillmentValue
)
{
fulfill
=
function
(
fulfillmentValue
)
{
if
(
resolved
)
{
return
;}
if
(
resolved
)
{
return
;}
queue
.
isFulfilled
=
true
;
queue
.
isFulfilled
=
true
;
...
@@ -774,7 +731,6 @@ define("rsvp/queue",
...
@@ -774,7 +731,6 @@ define("rsvp/queue",
resolved
=
true
;
resolved
=
true
;
return
fail
(
rejectedReason
);
return
fail
(
rejectedReason
);
};
};
notify
=
progress
;
},
canceller
);
},
canceller
);
promise_list
.
push
(
resolve
());
promise_list
.
push
(
resolve
());
...
@@ -798,7 +754,7 @@ define("rsvp/queue",
...
@@ -798,7 +754,7 @@ define("rsvp/queue",
return
promise
.
then
.
apply
(
promise
,
arguments
);
return
promise
.
then
.
apply
(
promise
,
arguments
);
};
};
queue
.
push
=
function
(
done
,
fail
,
progress
)
{
queue
.
push
=
function
(
done
,
fail
)
{
var
last_promise
=
promise_list
[
promise_list
.
length
-
1
],
var
last_promise
=
promise_list
[
promise_list
.
length
-
1
],
next_promise
;
next_promise
;
...
@@ -806,11 +762,11 @@ define("rsvp/queue",
...
@@ -806,11 +762,11 @@ define("rsvp/queue",
throw
new
ResolvedQueueError
();
throw
new
ResolvedQueueError
();
}
}
next_promise
=
last_promise
.
then
(
done
,
fail
,
progress
);
next_promise
=
last_promise
.
then
(
done
,
fail
);
promise_list
.
push
(
next_promise
);
promise_list
.
push
(
next_promise
);
// Handle pop
// Handle pop
last_promise
=
next_promise
.
then
(
function
(
fulfillmentValue
)
{
promise_list
.
push
(
next_promise
.
then
(
function
(
fulfillmentValue
)
{
promise_list
.
splice
(
0
,
2
);
promise_list
.
splice
(
0
,
2
);
if
(
promise_list
.
length
===
0
)
{
if
(
promise_list
.
length
===
0
)
{
fulfill
(
fulfillmentValue
);
fulfill
(
fulfillmentValue
);
...
@@ -824,13 +780,7 @@ define("rsvp/queue",
...
@@ -824,13 +780,7 @@ define("rsvp/queue",
}
else
{
}
else
{
throw
rejectedReason
;
throw
rejectedReason
;
}
}
},
function
(
notificationValue
)
{
}));
if
(
promise_list
[
promise_list
.
length
-
1
]
===
last_promise
)
{
notify
(
notificationValue
);
}
return
notificationValue
;
});
promise_list
.
push
(
last_promise
);
return
this
;
return
this
;
};
};
...
...
dist/rsvp-2.0.4.js
View file @
cde40f5c
...
@@ -60,7 +60,7 @@ define("rsvp/all",
...
@@ -60,7 +60,7 @@ define("rsvp/all",
}
}
}
}
return
new
Promise
(
function
(
resolve
,
reject
,
notify
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
results
=
[],
remaining
=
promises
.
length
,
var
results
=
[],
remaining
=
promises
.
length
,
promise
,
remaining_count
=
promises
.
length
-
expected_count
;
promise
,
remaining_count
=
promises
.
length
-
expected_count
;
...
@@ -90,12 +90,6 @@ define("rsvp/all",
...
@@ -90,12 +90,6 @@ define("rsvp/all",
}
}
}
}
function
notifier
(
index
)
{
return
function
(
value
)
{
notify
({
"
index
"
:
index
,
"
value
"
:
value
});
};
}
function
cancelAll
(
rejectionValue
)
{
function
cancelAll
(
rejectionValue
)
{
reject
(
rejectionValue
);
reject
(
rejectionValue
);
canceller
();
canceller
();
...
@@ -105,7 +99,7 @@ define("rsvp/all",
...
@@ -105,7 +99,7 @@ define("rsvp/all",
promise
=
promises
[
i
];
promise
=
promises
[
i
];
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
promise
.
then
(
resolver
(
i
),
cancelAll
,
notifier
(
i
)
);
promise
.
then
(
resolver
(
i
),
cancelAll
);
}
else
{
}
else
{
resolveAll
(
i
,
promise
);
resolveAll
(
i
,
promise
);
}
}
...
@@ -213,14 +207,14 @@ define("rsvp/async",
...
@@ -213,14 +207,14 @@ define("rsvp/async",
};
};
}
}
if
(
typeof
setImmediate
===
'
function
'
)
{
if
(
checkNativePromise
())
{
async
=
useNativePromise
();
}
else
if
(
typeof
setImmediate
===
'
function
'
)
{
async
=
useSetImmediate
();
async
=
useSetImmediate
();
}
else
if
(
typeof
process
!==
'
undefined
'
&&
{}.
toString
.
call
(
process
)
===
'
[object process]
'
)
{
}
else
if
(
typeof
process
!==
'
undefined
'
&&
{}.
toString
.
call
(
process
)
===
'
[object process]
'
)
{
async
=
useNextTick
();
async
=
useNextTick
();
}
else
if
(
BrowserMutationObserver
)
{
}
else
if
(
BrowserMutationObserver
)
{
async
=
useMutationObserver
();
async
=
useMutationObserver
();
}
else
if
(
checkNativePromise
())
{
async
=
useNativePromise
();
}
else
{
}
else
{
async
=
useSetTimeout
();
async
=
useSetTimeout
();
}
}
...
@@ -529,11 +523,6 @@ define("rsvp/promise",
...
@@ -529,11 +523,6 @@ define("rsvp/promise",
reject
(
promise
,
value
);
reject
(
promise
,
value
);
};
};
var
notifyPromise
=
function
(
value
)
{
if
(
resolved
)
{
return
;
}
notify
(
promise
,
value
);
};
this
.
on
(
'
promise:failed
'
,
function
(
event
)
{
this
.
on
(
'
promise:failed
'
,
function
(
event
)
{
this
.
trigger
(
'
error
'
,
{
detail
:
event
.
detail
});
this
.
trigger
(
'
error
'
,
{
detail
:
event
.
detail
});
},
this
);
},
this
);
...
@@ -557,7 +546,7 @@ define("rsvp/promise",
...
@@ -557,7 +546,7 @@ define("rsvp/promise",
};
};
try
{
try
{
resolver
(
resolvePromise
,
rejectPromise
,
notifyPromise
);
resolver
(
resolvePromise
,
rejectPromise
);
}
catch
(
e
)
{
}
catch
(
e
)
{
rejectPromise
(
e
);
rejectPromise
(
e
);
}
}
...
@@ -602,22 +591,6 @@ define("rsvp/promise",
...
@@ -602,22 +591,6 @@ define("rsvp/promise",
}
}
};
};
var
invokeNotifyCallback
=
function
(
promise
,
callback
,
event
)
{
var
value
;
if
(
typeof
callback
===
'
function
'
)
{
try
{
value
=
callback
(
event
.
detail
);
}
catch
(
e
)
{
// stop propagating
return
;
}
notify
(
promise
,
value
);
}
else
{
notify
(
promise
,
event
.
detail
);
}
};
Promise
.
prototype
=
{
Promise
.
prototype
=
{
constructor
:
Promise
,
constructor
:
Promise
,
...
@@ -626,7 +599,7 @@ define("rsvp/promise",
...
@@ -626,7 +599,7 @@ define("rsvp/promise",
rejectedReason
:
undefined
,
rejectedReason
:
undefined
,
fulfillmentValue
:
undefined
,
fulfillmentValue
:
undefined
,
then
:
function
(
done
,
fail
,
progress
)
{
then
:
function
(
done
,
fail
)
{
this
.
off
(
'
error
'
,
onerror
);
this
.
off
(
'
error
'
,
onerror
);
var
thenPromise
=
new
this
.
constructor
(
function
()
{},
var
thenPromise
=
new
this
.
constructor
(
function
()
{},
...
@@ -654,10 +627,6 @@ define("rsvp/promise",
...
@@ -654,10 +627,6 @@ define("rsvp/promise",
invokeCallback
(
'
reject
'
,
thenPromise
,
fail
,
event
);
invokeCallback
(
'
reject
'
,
thenPromise
,
fail
,
event
);
});
});
this
.
on
(
'
promise:notified
'
,
function
(
event
)
{
invokeNotifyCallback
(
thenPromise
,
progress
,
event
);
});
return
thenPromise
;
return
thenPromise
;
},
},
...
@@ -693,11 +662,6 @@ define("rsvp/promise",
...
@@ -693,11 +662,6 @@ define("rsvp/promise",
then
=
value
.
then
;
then
=
value
.
then
;
if
(
isFunction
(
then
))
{
if
(
isFunction
(
then
))
{
if
(
isFunction
(
value
.
on
))
{
value
.
on
(
'
promise:notified
'
,
function
(
event
)
{
notify
(
promise
,
event
.
detail
);
});
}
promise
.
on
(
'
promise:cancelled
'
,
function
(
event
)
{
promise
.
on
(
'
promise:cancelled
'
,
function
(
event
)
{
if
(
isFunction
(
value
.
cancel
))
{
if
(
isFunction
(
value
.
cancel
))
{
value
.
cancel
();
value
.
cancel
();
...
@@ -750,12 +714,6 @@ define("rsvp/promise",
...
@@ -750,12 +714,6 @@ define("rsvp/promise",
});
});
}
}
function
notify
(
promise
,
value
)
{
config
.
async
(
function
()
{
promise
.
trigger
(
'
promise:notified
'
,
{
detail
:
value
});
});
}
__exports__
.
Promise
=
Promise
;
__exports__
.
Promise
=
Promise
;
});
});
...
@@ -783,7 +741,6 @@ define("rsvp/queue",
...
@@ -783,7 +741,6 @@ define("rsvp/queue",
promise
,
promise
,
fulfill
,
fulfill
,
reject
,
reject
,
notify
,
resolved
;
resolved
;
if
(
!
(
this
instanceof
Queue
))
{
if
(
!
(
this
instanceof
Queue
))
{
...
@@ -796,7 +753,7 @@ define("rsvp/queue",
...
@@ -796,7 +753,7 @@ define("rsvp/queue",
}
}
}
}
promise
=
new
Promise
(
function
(
done
,
fail
,
progress
)
{
promise
=
new
Promise
(
function
(
done
,
fail
)
{
fulfill
=
function
(
fulfillmentValue
)
{
fulfill
=
function
(
fulfillmentValue
)
{
if
(
resolved
)
{
return
;}
if
(
resolved
)
{
return
;}
queue
.
isFulfilled
=
true
;
queue
.
isFulfilled
=
true
;
...
@@ -811,7 +768,6 @@ define("rsvp/queue",
...
@@ -811,7 +768,6 @@ define("rsvp/queue",
resolved
=
true
;
resolved
=
true
;
return
fail
(
rejectedReason
);
return
fail
(
rejectedReason
);
};
};
notify
=
progress
;
},
canceller
);
},
canceller
);
promise_list
.
push
(
resolve
());
promise_list
.
push
(
resolve
());
...
@@ -835,7 +791,7 @@ define("rsvp/queue",
...
@@ -835,7 +791,7 @@ define("rsvp/queue",
return
promise
.
then
.
apply
(
promise
,
arguments
);
return
promise
.
then
.
apply
(
promise
,
arguments
);
};
};
queue
.
push
=
function
(
done
,
fail
,
progress
)
{
queue
.
push
=
function
(
done
,
fail
)
{
var
last_promise
=
promise_list
[
promise_list
.
length
-
1
],
var
last_promise
=
promise_list
[
promise_list
.
length
-
1
],
next_promise
;
next_promise
;
...
@@ -843,11 +799,11 @@ define("rsvp/queue",
...
@@ -843,11 +799,11 @@ define("rsvp/queue",
throw
new
ResolvedQueueError
();
throw
new
ResolvedQueueError
();
}
}
next_promise
=
last_promise
.
then
(
done
,
fail
,
progress
);
next_promise
=
last_promise
.
then
(
done
,
fail
);
promise_list
.
push
(
next_promise
);
promise_list
.
push
(
next_promise
);
// Handle pop
// Handle pop
last_promise
=
next_promise
.
then
(
function
(
fulfillmentValue
)
{
promise_list
.
push
(
next_promise
.
then
(
function
(
fulfillmentValue
)
{
promise_list
.
splice
(
0
,
2
);
promise_list
.
splice
(
0
,
2
);
if
(
promise_list
.
length
===
0
)
{
if
(
promise_list
.
length
===
0
)
{
fulfill
(
fulfillmentValue
);
fulfill
(
fulfillmentValue
);
...
@@ -861,13 +817,7 @@ define("rsvp/queue",
...
@@ -861,13 +817,7 @@ define("rsvp/queue",
}
else
{
}
else
{
throw
rejectedReason
;
throw
rejectedReason
;
}
}
},
function
(
notificationValue
)
{
}));
if
(
promise_list
[
promise_list
.
length
-
1
]
===
last_promise
)
{
notify
(
notificationValue
);
}
return
notificationValue
;
});
promise_list
.
push
(
last_promise
);
return
this
;
return
this
;
};
};
...
...
dist/rsvp-2.0.4.min.js
View file @
cde40f5c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment