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>";
});
The names of events are case-insensitive.
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);
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