Commit e35322e8 by Thimo Kraemer

Added variable timeout for each action

parent f584d356
/*
* KSS-RPC v0.12-beta
* KSS-RPC v0.13-beta
*
* Copyright (c) 2017, joonis new media
* Author: Thimo Kraemer <thimo.kraemer@joonis.de>
......@@ -61,7 +61,7 @@
******************************************************************************************/
var kss = {
version: '0.12-beta',
version: '0.13-beta',
_initialized: false,
_ruleSheets: {},
_eventBinders: {},
......@@ -455,14 +455,10 @@ kss.RuleSheet.prototype = {
kss.each(rules, function(rule) {
if (rule.type == 'config' &&
(!rule.name || rule.name == 'kss')) {
var copy = {}, key;
for (key in config) {
copy[key] = config[key];
}
config = copy;
config = Object.create(config);
kss.each(rule.declarations, function(decl) {
if (decl.type == 'declaration') {
key = kss.camelCase(decl.property);
var key = kss.camelCase(decl.property);
config[key] = decl.value;
}
});
......@@ -683,7 +679,8 @@ kss._EventHandler.prototype = {
var props = this.propertyGetter({
selector: null,
precondition: true,
includeform: null
includeform: null,
timeout: null
}, action.props);
if (!props('precondition')) { return; }
var params = {};
......@@ -718,7 +715,7 @@ kss._EventHandler.prototype = {
}
else {
// server action
this._execServerAction(action.name, params);
this._execServerAction(action.name, params, props('timeout'));
}
}, this);
},
......@@ -749,12 +746,15 @@ kss._EventHandler.prototype = {
this._callBinders('oncomplete', action, error);
},
_execServerAction: function(action, params) {
_execServerAction: function(action, params, timeout) {
// Prevent server actions for mouse moves
if (['mousemove','drag','dragover'].indexOf(this.eventname) > -1) {
return;
}
var config = this.rule.config;
var config = Object.create(this.rule.config);
if (timeout) {
config.timeout = timeout;
}
if (params && (config.protocol == 'xml-rpc' ||
config.protocol == 'json-rpc-v1')) {
params = [params];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment