Bläddra i källkod

Emitters now include the triggering element in the emitted event. Modal updated for the new element.

dev-bank
Bryan Miller 5 år sedan
förälder
incheckning
9d661281c3
2 ändrade filer med 5 tillägg och 4 borttagningar
  1. +3
    -2
      app/js/ui/Emitters.js
  2. +2
    -2
      app/js/ui/Modal.js

+ 3
- 2
app/js/ui/Emitters.js Visa fil

@@ -3,7 +3,7 @@ import GlobalEvents from "/app/js/common/EventCaller.js";

function handle_emitter(event){
if (this.hasAttribute("emit")){
var args = [this.getAttribute("emit")];
var args = [this.getAttribute("emit"), this];
if (this.hasAttribute("emit-args")){
try {
var j = JSON.parse(this.getAttribute("emit-args"));
@@ -13,7 +13,8 @@ function handle_emitter(event){
args.push(j);
}
} catch (e) {
console.log("Failed to emit '" + args[0] + "'. Attribute 'emit-args' contains malformed JSON.");
console.log("Failed to emit '" + args[0] +"': " + e.toString());
//console.log("Failed to emit '" + args[0] + "'. Attribute 'emit-args' contains malformed JSON.");
}
}
GlobalEvents.emit.apply(GlobalEvents, args);

+ 2
- 2
app/js/ui/Modal.js Visa fil

@@ -11,14 +11,14 @@ class Modal{
}
}).bind(this));

GlobalEvents.listen("modal-open", (function(event){
GlobalEvents.listen("modal-open", (function(target, event){
if (event.hasOwnProperty("id") && typeof(event.id) === 'string'){
var force = (event.hasOwnProperty("force")) ? event.force === true : false;
this.open_modal_id(event.id, force);
}
}).bind(this));

GlobalEvents.listen("modal-close", (function(event){
GlobalEvents.listen("modal-close", (function(target, event){
this.close_modal();
}).bind(this));
}

Laddar…
Avbryt
Spara