FileUpload

FileUpload

new FileUpload(element, options)

Source:
Parameters:
NameTypeDescription
elementHTMLElement

DOM element for component instantiation and scope

optionsObject
Properties
NameTypeDescription
groupSelectorString

Selector for file upload form group

buttonSelectorString

Selector for file upload button

listSelectorString

Selector for list of file names

labelChooseString

Label choose state

labelReplaceString

Label replace state

attachChangeListenerBoolean

Whether or not to bind change events on toggle

Classes

FileUpload

Members

(static) supportedEvents :Array.<string>

Description:
  • An array of supported events for this component.

Source:

An array of supported events for this component.

Type:
  • Array.<string>

Methods

destroy()

Description:
  • Destroy component.

Source:

handleChange(e)

Source:
Parameters:
NameTypeDescription
eEvent
Fires:

init()

Description:
  • Initialise component.

Source:

on(eventName, callback) → {void}

Description:
  • Register a callback function for a specific event.

Source:
Example
// Registering a callback for the 'onSelection' event
fileUpload.on('onSelection', (event) => {
  console.log('Open event occurred!', event);
});
Parameters:
NameTypeDescription
eventNamestring

The name of the event to listen for.

callbackfunction

The callback function to be invoked when the event occurs.

Returns:
Type
void

trigger(eventName, eventData)

Description:
  • Trigger a component event.

Source:
Parameters:
NameTypeDescription
eventNamestring

The name of the event to trigger.

eventDataany

Data associated with the event.

(static) autoInit(root) → {FileUpload}

Source:
Parameters:
NameTypeDescription
rootHTMLElement

DOM element for component instantiation and scope

Returns:

An instance of FileUpload.

Type
FileUpload

Events

onSelection

Source: