Handling Events

Attaching Event Listeners

You can attach event listeners with vault.events.on():

var info = document.getElementById("events-info");
 
vault.events.on("BeforeAdd", function(obj) {
    info.innerHTML += "before file add: " + JSON.stringify(obj) + "</br>";
});

Related sample:  Vault. Events

The names of events are case-insensitive.

Detaching Event Listeners

To detach events, use vault.events.detach():

var onbeforeadd = vault.events.on("BeforeAdd", function(obj) {
    console.log("before file add: ",JSON.stringify(obj));
});
vault.events.detach(onbeforeadd);

Calling Events

To call events, use vault.events.fire():

vault.events.fire("name",args);
// where args is an array of arguments

The list of events is available in the API section.

Back to top