Guides

JavaScript Events

When users select and deselect files or create File Distributions, filespin.js will emit events as detailed below:-

EventDescription
readyRaised when the Connector Dialog is ready and displayed. This event does not supply any data.
closeConnectorRaised when the Connector Dialog is closed by user. This event does not supply any data.
connector-file-selectedRaised when the user selects a file
connector-file-deselectedRaised when the user deselects a file

Listening to Connector Events

To listen to events, use the FileSpin.on API. You can listen to a specific event or all events using the special * event.

//listen to 'connector-file-selected' event
FileSpin.on("connector-file-selected", function (data) {
  console.log(data);

  //Perhaps, hide the Connector once a file is selected
  FileSpin.hideConnector();
});

//listen to all events
FileSpin.on("*", function (data, eventName) {
  console.log(eventName, "triggered with data", data);
});

Connector Event Data

The events provide file data in the following formats:-

EventData Format
connector-file-selectedStandard Asset Data Format
connector-file-deselectedStandard Asset Data Format