mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-13 16:08:41 +00:00
Fix minor bugs and double submit leak
This commit is contained in:
parent
edc596aba2
commit
3f9b035f4d
|
|
@ -111,16 +111,19 @@
|
||||||
*/
|
*/
|
||||||
trigger (group, id = '', data = null)
|
trigger (group, id = '', data = null)
|
||||||
{
|
{
|
||||||
if (!this.callbacks.hasOwnProperty(group)) {
|
if (!this.callbacks.hasOwnProperty(group) || Math.abs(Date.now() - this.callbacks[group].lastRun) < 500) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(group, id);
|
||||||
|
|
||||||
if (typeof this.groups[group] !== 'undefined') {
|
if (typeof this.groups[group] !== 'undefined') {
|
||||||
this.groups[group][id] = true;
|
this.groups[group][id] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.hasOutstanding(group)) {
|
if (!this.hasOutstanding(group)) {
|
||||||
// todo if it is route then call dispatcher?
|
// todo if it is route then call dispatcher?
|
||||||
|
this.callbacks[group].lastRun = Date.now();
|
||||||
this.callbacks[group].func(data);
|
this.callbacks[group].func(data);
|
||||||
|
|
||||||
if (this.callbacks[group].remove) {
|
if (this.callbacks[group].remove) {
|
||||||
|
|
@ -215,7 +218,7 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.callbacks[group] = {remove: remove, reset: reset, func: callback};
|
this.callbacks[group] = {remove: remove, reset: reset, func: callback, lastRun: 0};
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let childLength = c.length;
|
let childLength = c.length;
|
||||||
|
|
||||||
for (let j = 0; j < childLength; ++j) {
|
for (let j = 0; j < childLength; ++j) {
|
||||||
this.bindListener(c[j].id, listeners[i]);
|
this.bindListener(c[j].id, listeners[i]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (form.getMethod() !== jsOMS.Message.Request.RequestMethod.GET
|
if (form.getMethod() !== jsOMS.Message.Request.RequestMethod.GET
|
||||||
&& Math.floor(Date.now()) - form.getLastSubmit() < 500
|
&& Math.abs(Date.now() - form.getLastSubmit()) < 500
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user