Pass values through events

I am basically trying to get a value of script into another one. Currently, events without values look like this for me.

Script 1

Swapper.prototype.initialize = function() {"get:select", this.onGetSelect, this);

Swapper.prototype.onGetSelect = function(dt) {
    alert("event found");

Script 2"get:select");

However, if I want to alert a value from script 2 in script 1, how would I do it?


You can pass arguments in your fire call like this:"get:select", true, 12, 'start');

Now on your on event handler callback, the arguments will be automatically made available:

Swapper.prototype.onGetSelect = function(switch, amount, state) {
    console.log(switch, amount, state);
    // prints true, 12, "start"

I think this should work. Really helped.

1 Like