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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
656f946f
Commit
656f946f
authored
Dec 14, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] loopEventListener: immediately execute callback when event is triggered
parent
66f92a05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_global_js.xml
...PathTemplateItem/web_page_module/rjs_gadget_global_js.xml
+23
-10
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_global_js.xml
View file @
656f946f
...
@@ -107,13 +107,17 @@
...
@@ -107,13 +107,17 @@
"use strict";\n
"use strict";\n
\n
\n
window.loopEventListener = function (target, type, useCapture, callback,\n
window.loopEventListener = function (target, type, useCapture, callback,\n
allowD
efault) {\n
prevent_d
efault) {\n
//////////////////////////\n
//////////////////////////\n
// Infinite event listener (promise is never resolved)\n
// Infinite event listener (promise is never resolved)\n
// eventListener is removed when promise is cancelled/rejected\n
// eventListener is removed when promise is cancelled/rejected\n
//////////////////////////\n
//////////////////////////\n
var handle_event_callback,\n
var handle_event_callback,\n
callback_promise;\n
callback_promise;\n
\n
if (prevent_default === undefined) {\n
prevent_default = true;\n
}\n
\n
\n
function cancelResolver() {\n
function cancelResolver() {\n
if ((callback_promise !== undefined) &&\n
if ((callback_promise !== undefined) &&\n
...
@@ -129,16 +133,25 @@
...
@@ -129,16 +133,25 @@
cancelResolver();\n
cancelResolver();\n
}\n
}\n
function itsANonResolvableTrap(resolve, reject) {\n
function itsANonResolvableTrap(resolve, reject) {\n
\n
var result;
\n
handle_event_callback = function (evt) {\n
handle_event_callback = function (evt) {\n
evt.stopPropagation();
\n
if (prevent_default) {
\n
if (allowDefault !== true) {
\n
evt.stopPropagation();
\n
evt.preventDefault();\n
evt.preventDefault();\n
}\n
}\n
\n
cancelResolver();\n
cancelResolver();\n
callback_promise = new RSVP.Queue()\n
\n
try {\n
result = callback(evt);\n
} catch (e) {\n
result = RSVP.reject(e);\n
}\n
\n
callback_promise = result;\n
new RSVP.Queue()\n
.push(function () {\n
.push(function () {\n
return
callback(evt)
;\n
return
result
;\n
})\n
})\n
.push(undefined, function (error) {\n
.push(undefined, function (error) {\n
if (!(error instanceof RSVP.CancellationError)) {\n
if (!(error instanceof RSVP.CancellationError)) {\n
...
@@ -314,7 +327,7 @@
...
@@ -314,7 +327,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -328,7 +341,7 @@
...
@@ -328,7 +341,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
37.42855.7627.63982
</string>
</value>
<value>
<string>
9
47.51167.64410.14796
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -346,8 +359,8 @@
...
@@ -346,8 +359,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
11056451.0
</float>
<float>
14
50099422.01
</float>
<string>
GMT
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</object>
...
...
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