Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yusei Tahara
erp5
Commits
e3cedc8e
Commit
e3cedc8e
authored
Jun 03, 2016
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: add promiseDoWhile tool to rjs_gadget_global_js.js
/reviewed-on
nexedi/erp5!122
parent
0274584b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_global_js.js
.../PathTemplateItem/web_page_module/rjs_gadget_global_js.js
+25
-0
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_global_js.js
View file @
e3cedc8e
...
...
@@ -101,4 +101,29 @@
});
};
window
.
promiseDoWhile
=
function
(
loopFunction
,
input
)
{
// calls loopFunction(input) until it returns a non positive value
// this queue is to protect the inner loop queue from the
// `promiseDoWhile` caller, avoiding it to enqueue the inner
// loop queue.
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
// here is the inner loop queue
var
loop_queue
=
new
RSVP
.
Queue
();
function
iterate
(
previous_iteration_result
)
{
if
(
!
previous_iteration_result
)
{
return
input
;
}
loop_queue
.
push
(
iterate
);
return
loopFunction
(
input
);
}
return
loop_queue
.
push
(
function
()
{
return
loopFunction
(
input
);
})
.
push
(
iterate
);
});
};
}(
window
,
RSVP
,
FileReader
));
\ No newline at end of file
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