mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 09:15:41 +00:00
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
class InteractionElement {
|
|
constructor(htmlId="",
|
|
checkStatus=true,
|
|
disabledBefore=true,
|
|
disabledAfter=false,
|
|
hideBefore=true,
|
|
hideAfter=false) {
|
|
this.htmlId = htmlId;
|
|
this.checkStatus = checkStatus;
|
|
this.callbacks = {};
|
|
this.disabledBefore = disabledBefore;
|
|
this.disabledAfter = disabledAfter;
|
|
this.hideBefore = hideBefore;
|
|
this.hideAfter = hideAfter;
|
|
}
|
|
|
|
getElement() {
|
|
this.interactionStatusElement = document.getElementById(this.htmlId);
|
|
return this.interactionStatusElement;
|
|
}
|
|
|
|
setCallback(trigger, callback, bindThis, args=[]) {
|
|
this.callbacks[trigger] = {
|
|
"function": callback,
|
|
"bindThis": bindThis,
|
|
"args": args
|
|
};
|
|
}
|
|
|
|
bindThisToCallback(trigger) {
|
|
let callback = this.callbacks[trigger];
|
|
let boundedCallback = callback["function"].bind(callback.bindThis);
|
|
return boundedCallback;
|
|
}
|
|
} |