Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
e6cc8453
Commit
e6cc8453
authored
Sep 25, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[rsvp] update RSVP build
parent
081fedb8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
53 deletions
+77
-53
external/rsvp-2.0.4.js
external/rsvp-2.0.4.js
+77
-53
No files found.
external/rsvp-2.0.4.js
View file @
e6cc8453
...
...
@@ -379,10 +379,10 @@ define("rsvp/events",
__exports__
.
EventTarget
=
EventTarget
;
});
define
(
"
rsvp/hash
"
,
[
"
rsvp/
defer
"
,
"
exports
"
],
[
"
rsvp/
promise
"
,
"
exports
"
],
function
(
__dependency1__
,
__exports__
)
{
"
use strict
"
;
var
defer
=
__dependency1__
.
defer
;
var
Promise
=
__dependency1__
.
Promise
;
function
size
(
object
)
{
var
s
=
0
;
...
...
@@ -395,38 +395,61 @@ define("rsvp/hash",
}
function
hash
(
promises
)
{
var
results
=
{},
deferred
=
defer
(),
remaining
=
size
(
promises
);
function
canceller
()
{
var
promise
,
key
;
for
(
key
in
promises
)
{
if
(
promises
.
hasOwnProperty
(
key
))
{
promise
=
promises
[
key
];
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
&&
typeof
promise
.
cancel
===
'
function
'
)
{
promise
.
cancel
();
}
}
}
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
results
=
{},
remaining
=
size
(
promises
),
promise
;
if
(
remaining
===
0
)
{
deferred
.
resolve
({}
);
resolve
(
results
);
}
var
resolver
=
function
(
prop
)
{
function
resolver
(
key
)
{
return
function
(
value
)
{
resolveAll
(
prop
,
value
);
};
resolveAll
(
key
,
value
);
};
}
var
resolveAll
=
function
(
prop
,
value
)
{
results
[
prop
]
=
value
;
function
resolveAll
(
key
,
value
)
{
results
[
key
]
=
value
;
if
(
--
remaining
===
0
)
{
deferred
.
resolve
(
results
);
resolve
(
results
);
}
}
};
var
rejectAll
=
function
(
error
)
{
deferred
.
reject
(
error
);
};
function
cancelAll
(
rejectionValue
)
{
reject
(
rejectionValue
);
canceller
();
}
for
(
var
prop
in
promises
)
{
if
(
promises
[
prop
]
&&
typeof
promises
[
prop
].
then
===
'
function
'
)
{
promises
[
prop
].
then
(
resolver
(
prop
),
rejectAll
);
promise
=
promises
[
prop
];
if
(
promise
&&
typeof
promise
.
then
===
'
function
'
)
{
promise
.
then
(
resolver
(
prop
),
cancelAll
);
}
else
{
resolveAll
(
prop
,
promises
[
prop
]
);
resolveAll
(
prop
,
promise
);
}
}
return
deferred
.
promise
;
},
canceller
);
}
...
...
@@ -533,6 +556,7 @@ define("rsvp/promise",
// For now, simply reject the promise and does not propagate the cancel
// to parent or children
if
(
resolved
)
{
return
;
}
promise
.
isCancelled
=
true
;
if
(
canceller
!==
undefined
)
{
try
{
canceller
();
...
...
@@ -564,6 +588,7 @@ define("rsvp/promise",
if
(
promise
.
isFulfilled
)
{
return
;
}
if
(
promise
.
isRejected
)
{
return
;
}
if
(
promise
.
isCancelled
)
{
return
;
}
if
(
hasCallback
)
{
try
{
...
...
@@ -594,6 +619,7 @@ define("rsvp/promise",
Promise
.
prototype
=
{
constructor
:
Promise
,
isCancelled
:
undefined
,
isRejected
:
undefined
,
isFulfilled
:
undefined
,
rejectedReason
:
undefined
,
...
...
@@ -735,7 +761,7 @@ define("rsvp/queue",
ResolvedQueueError
.
prototype
=
new
Error
();
ResolvedQueueError
.
prototype
.
constructor
=
ResolvedQueueError
;
var
Queue
=
function
()
{
var
Queue
=
function
(
thenable
)
{
var
queue
=
this
,
promise_list
=
[],
promise
,
...
...
@@ -748,11 +774,31 @@ define("rsvp/queue",
}
function
canceller
()
{
for
(
var
i
=
0
;
i
<
2
;
i
++
)
{
promise_list
[
i
].
cancel
();
for
(
var
i
=
promise_list
.
length
;
i
>
0
;
i
--
)
{
promise_list
[
i
-
1
].
cancel
();
}
}
function
checkPromise
(
next_promise
)
{
promise_list
.
push
(
next_promise
);
// Handle pop
promise_list
.
push
(
next_promise
.
then
(
function
(
fulfillmentValue
)
{
promise_list
.
splice
(
0
,
2
);
if
(
promise_list
.
length
===
0
)
{
fulfill
(
fulfillmentValue
);
}
else
{
return
fulfillmentValue
;
}
},
function
(
rejectedReason
)
{
promise_list
.
splice
(
0
,
2
);
if
(
promise_list
.
length
===
0
)
{
reject
(
rejectedReason
);
}
else
{
throw
rejectedReason
;
}
}));
}
promise
=
new
Promise
(
function
(
done
,
fail
)
{
fulfill
=
function
(
fulfillmentValue
)
{
if
(
resolved
)
{
return
;}
...
...
@@ -770,13 +816,7 @@ define("rsvp/queue",
};
},
canceller
);
promise_list
.
push
(
resolve
());
promise_list
.
push
(
promise_list
[
0
].
then
(
function
()
{
promise_list
.
splice
(
0
,
2
);
if
(
promise_list
.
length
===
0
)
{
fulfill
();
}
}));
checkPromise
(
resolve
(
thenable
));
queue
.
cancel
=
function
()
{
if
(
resolved
)
{
return
;}
...
...
@@ -799,25 +839,9 @@ define("rsvp/queue",
throw
new
ResolvedQueueError
();
}
next_promise
=
last_promise
.
then
(
done
,
fail
);
promise_list
.
push
(
next_promise
);
// Handle pop
promise_list
.
push
(
next_promise
.
then
(
function
(
fulfillmentValue
)
{
promise_list
.
splice
(
0
,
2
);
if
(
promise_list
.
length
===
0
)
{
fulfill
(
fulfillmentValue
);
}
else
{
return
fulfillmentValue
;
}
},
function
(
rejectedReason
)
{
promise_list
.
splice
(
0
,
2
);
if
(
promise_list
.
length
===
0
)
{
reject
(
rejectedReason
);
}
else
{
throw
rejectedReason
;
}
}));
checkPromise
(
last_promise
.
then
(
done
,
fail
));
return
this
;
};
...
...
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