Frage

 var my_variables = {};

_.extend(my_variables,Backbone.Events);

my_variables.on("event_name",function(msg)
{
   alert("easy street"+msg);
});

proxy.on("all", function(eventName) 
{
  my_variables.trigger(eventName);
});

my_variables.trigger("event_name");

Im trying to follow the code by reading the documentation, as far as I understood the proxy.on event is supposed to be called every time any event gets triggered. On this code, I get the error message

"proxy is not defined"

how to fix this here is the spot on the documentation documentation on events!

War es hilfreich?

Lösung

The example code uses an example object (proxy) to do the call on..

For you to make it work you need to replace proxy with the name of your object.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top