Global

Type Definitions

eventCallback(Event)

Invoked when notifying a handler about an event it has registered for.
Parameters:
Name Type Description
Event Event object associated with the registered event.
Since:
  • 0.0.0
Source:

Events

add

Add one or more items to the system. This event is triggered before the item(s) is/are actually persisted. If the event is cancelled, the item(s) will not be persisted. Furthermore, the item(s) and their associated data can be influenced by various event handlers.
Type:
Properties:
Name Type Description
payload Event#payload Any data to store with the item. In addition to the standardized properties described below, you may include other custom properties that are useful to your specific use case or plug-in as well. Note that the payload may be an Object or an Array. In order to group multiple entries to be added, include an Array as the payload. In that case, each array element will represent a single item and its associated data. If you would like to group multiple items this way, the payload properties documented here apply to each object in the array.
Properties
Name Type Attributes Description
item * The item to be added. May be anything, such as a File, Blob, <canvas>, etc.
id string <optional>
A unique ID for this item. Will be calculated by Core if not provided.
name string <optional>
A name for the item.
Since:
  • 0.0.0
Source:
Listeners of This Event:
Example
// add a single item, ID will be generated
api.fire(new Event({
   type: 'add',
   payload: {
      item: blob1,
      name: 'cat photos'
   }
}))

// add multiple items, IDs will be generated
api.fire(new Event({
   type: 'add',
   payload: [
      {
         item: blob1,
         name: 'cat photos'
      },
      {
         item: blob2,
         name: 'dog photos'
      }
   ]
}))

added

Indicates that one or more items have been added to the system. This is an informational event.
Type:
Properties:
Name Type Description
payload Event#payload This will always be an array of IDs representing the added items.
Since:
  • 0.0.0
Source:

allPluginsLoaded

Indicates that all plugins have been successfully loaded by the library. This is an informational event.
Type:
Since:
  • 0.0.0
Source:

remove

Removes one or more items from the system. This event is triggered before the item(s) is/are actually persisted. If the event is cancelled, the item(s) will not be removed. To remove only a subset of the items originally bound for removal, event handlers can return the subset of item IDs to remove. This means that another way to prevent all items from being removed is to return an empty array.
Type:
Properties:
Name Type Description
payload Event#payload One or more items to remove from the system. To remove a single item, simply include that item's ID as the payload. To remove multiple items, pass an array of the item IDs as the payload.
Since:
  • 0.0.0
Source:
Listeners of This Event:
Example
// remove a single item w/ an ID of 12345
api.fire(new Event({
   type: 'remove',
   payload: 12345
}))

// another way to remove a single item w/ an ID of 12345
api.fire(new Event({
   type: 'remove',
   payload: [12345]
}))

// remove two items w/ an IDs of 12345 and 67890 respectively
api.fire(new Event({
   type: 'remove',
   payload: [12345, 67890]
}))

removed

Indicates that one or more items have been removed from the system. This is an informational event.
Type:
Properties:
Name Type Description
payload Event#payload IDs of the removed items. This will always be an array.
Since:
  • 0.0.0
Source:

reset

Request that the system be reset. Currently, this only involves deleting the store of items.
Type:
Since:
  • 0.0.0
Source:
Listeners of This Event:
Example
// reset the system
api.fire(new Event({
   type: 'reset'
}))

resetComplete

Indicates that the system has been reset. This is an informational event.
Type:
Since:
  • 0.0.0
Source:

update

Requests that a specific item be updated. The properties included in the event payload will replace any existing properties on the matching item. If specified properties do not yet exist, they will be added. The item to update must be specified with an `id` property in the event payload.
Type:
Properties:
Name Type Description
payload Event#payload The properties to update on the target item.
Properties
Name Type Description
id string | number The ID of the item to update.
Since:
  • 0.0.0
Source:
Listeners of This Event:
Example
// change the name of an item w/ and ID of 123
api.fire(new Event({
   type: 'update',
   payload:  {
      id: 123,
      name: 'this is my new name'
   }
}))

updated

Indicates that a specific item has been updated. The payload describes the event that has been updated (via the ID property) along with the updated properties.
Type:
Properties:
Name Type Description
payload Event#payload Describes changes made to a specific item.
Properties
Name Type Description
id string | number The ID of the item that was updated.
Since:
  • 0.0.0
Source: