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
1ed8109e
Commit
1ed8109e
authored
Sep 25, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP Update RSVP version
parent
86121def
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
71 deletions
+50
-71
external/rsvp-2.0.4.js
external/rsvp-2.0.4.js
+50
-71
No files found.
external/rsvp-2.0.4.js
View file @
1ed8109e
...
@@ -602,7 +602,7 @@ define("rsvp/promise",
...
@@ -602,7 +602,7 @@ define("rsvp/promise",
then
:
function
(
done
,
fail
)
{
then
:
function
(
done
,
fail
)
{
this
.
off
(
'
error
'
,
onerror
);
this
.
off
(
'
error
'
,
onerror
);
var
thenPromise
=
new
this
.
constructor
(
function
()
{},
var
thenPromise
=
new
Promise
(
function
()
{},
function
()
{
function
()
{
thenPromise
.
trigger
(
'
promise:cancelled
'
,
{});
thenPromise
.
trigger
(
'
promise:cancelled
'
,
{});
});
});
...
@@ -736,97 +736,76 @@ define("rsvp/queue",
...
@@ -736,97 +736,76 @@ define("rsvp/queue",
ResolvedQueueError
.
prototype
.
constructor
=
ResolvedQueueError
;
ResolvedQueueError
.
prototype
.
constructor
=
ResolvedQueueError
;
var
Queue
=
function
()
{
var
Queue
=
function
()
{
var
queue
=
this
,
promise_list
=
[],
promise
,
fulfill
,
reject
,
resolved
;
if
(
!
(
this
instanceof
Queue
))
{
if
(
!
(
this
instanceof
Queue
))
{
return
new
Queue
();
return
new
Queue
();
}
}
function
canceller
()
{
var
promise_stack
=
[],
for
(
var
i
=
0
;
i
<
2
;
i
++
)
{
// handleQueue
promise_list
[
i
].
cancel
();
detect_end_index
=
1
;
Promise
.
call
(
this
,
function
(
resolveQueue
,
rejectQueue
)
{
var
detectQueueSuccess
,
detectQueueError
;
function
handleQueue
()
{
if
(
promise_stack
.
length
===
detect_end_index
)
{
return
true
;
}
promise_stack
.
splice
(
0
,
detect_end_index
);
promise_stack
.
push
(
promise_stack
[
promise_stack
.
length
-
1
].
then
(
detectQueueSuccess
,
detectQueueError
)
);
detect_end_index
=
promise_stack
.
length
;
return
false
;
}
}
}
promise
=
new
Promise
(
function
(
done
,
fail
)
{
detectQueueSuccess
=
function
(
fulfillmentValue
)
{
fulfill
=
function
(
fulfillmentValue
)
{
if
(
handleQueue
())
{
if
(
resolved
)
{
return
;}
return
resolveQueue
(
fulfillmentValue
);
queue
.
isFulfilled
=
true
;
}
queue
.
fulfillmentValue
=
fulfillmentValue
;
return
fulfillmentValue
;
resolved
=
true
;
return
done
(
fulfillmentValue
);
};
};
reject
=
function
(
rejectedReason
)
{
if
(
resolved
)
{
return
;}
detectQueueError
=
function
(
rejectedReason
)
{
queue
.
isRejected
=
true
;
if
(
handleQueue
())
{
queue
.
rejectedReason
=
rejectedReason
;
return
rejectQueue
(
rejectedReason
)
;
resolved
=
true
;
}
return
fail
(
rejectedReason
)
;
throw
rejectedReason
;
};
};
},
canceller
);
promise_list
.
push
(
resolve
());
// Resolve by default
promise_list
.
push
(
promise_list
[
0
].
then
(
function
()
{
promise_stack
.
push
(
promise_list
.
splice
(
0
,
2
);
resolve
().
then
(
detectQueueSuccess
)
if
(
promise_list
.
length
===
0
)
{
);
fulfill
();
}
}));
queue
.
cancel
=
function
()
{
},
function
()
{
if
(
resolved
)
{
return
;}
// Cancel all created promises
resolved
=
true
;
var
i
;
promise
.
cancel
();
for
(
i
=
0
;
i
<
promise_stack
.
length
;
i
+=
1
)
{
promise
.
fail
(
function
(
rejectedReason
)
{
promise_stack
[
i
].
cancel
();
queue
.
isRejected
=
true
;
}
queue
.
rejectedReason
=
rejectedReason
;
});
};
queue
.
then
=
function
()
{
return
promise
.
then
.
apply
(
promise
,
arguments
);
};
queue
.
push
=
function
(
done
,
fail
)
{
});
var
last_promise
=
promise_list
[
promise_list
.
length
-
1
],
next_promise
;
if
(
resolved
)
{
this
.
push
=
function
(
done
,
fail
)
{
if
(
this
.
isFulfilled
||
this
.
isRejected
)
{
throw
new
ResolvedQueueError
();
throw
new
ResolvedQueueError
();
}
}
promise_stack
.
push
(
next_promise
=
last_promise
.
then
(
done
,
fail
);
promise_stack
[
promise_stack
.
length
-
1
].
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
;
}
}));
return
this
;
return
this
;
};
};
return
this
;
};
};
Queue
.
prototype
=
Object
.
create
(
Promise
.
prototype
);
Queue
.
prototype
=
Object
.
create
(
Promise
.
prototype
);
Queue
.
prototype
.
constructor
=
Queue
;
Queue
.
prototype
.
constructor
=
Queue
;
__exports__
.
Queue
=
Queue
;
__exports__
.
Queue
=
Queue
;
__exports__
.
ResolvedQueueError
=
ResolvedQueueError
;
__exports__
.
ResolvedQueueError
=
ResolvedQueueError
;
});
});
...
...
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