This commit is contained in:
2017-11-25 00:42:04 +01:00
parent 99b662ab6a
commit d7e9e22828
10 changed files with 362 additions and 225 deletions

View File

@@ -9,22 +9,18 @@ var Sui = {
},
link: (node) => {
return (actuator) => {
let update = function(endpoint, method, props) {
let update = actuator.handler || function(actuator) {
Sui.http.ajax({
method: method,
endpoint: node.api[endpoint],
data: props,
method: actuator.method,
endpoint: actuator.api,
data: actuator.data ?
actuator.data.call(this) : [this.value],
cache: false
}, actuator.onResponse || null);
};
Sui.select(actuator.selector).forEach( (domEl) =>{
let handle = function(event) {
update.call(this,
actuator.api,
actuator.method,
actuator.data ?
actuator.data.call(this) : [this.value]
);
update.call(this, actuator);
}
domEl.addEventListener(actuator.event, handle)
});