Skip to content

Events reference

Paweł Psztyć edited this page Oct 21, 2016 · 1 revision

Global events internally used by the app

request-object-delete

Fired when some element requests requests to be deleted. If any component handle this request it will return a result property in the event's details object. It's a promise that will resolve itself when the database operation succeed or reject if fails. If any required parameter is not set then the details object will result with error set to true and message property with the error message.

This operation will trigger request-object-deleted event.

Event's detail properties

Property name Property type Description
dbName String Name of the data store to perform an operation on.
id String The id of the object
rev String The revision id. It can be obtained by querying the PouchDB for this object.

Example

this.fire('request-object-delete', {
  dbName: 'saved-requests',
  id: doc._id,
  rev: doc._rev
});

request-object-deleted

Fired when the request has been removed from the data store.

Event's detail properties

Property name Property type Description
id String Id of the removed item.
oldRev String The rev property before the delete. If can be used to read previous value.

request-objects-deleted

Similar to request-object-deleted but it's fired when the bulk operation took place.

Event's detail properties

Property name Property type Description
items Array Array of responses to PounchDB delete operation. It will contain an id and new rev.
type String Can be one of saved, history and external

request-objects-restored

Opposite to the request-objects-deleted event. It's fired when the requests has been restored from deletion.

Event's detail properties

Property name Property type Description
items Array Array of PounchDB docs. It will have updated rev property.
type String Can be one of saved, history and external

request-name-change

Fired when some element requested to change name of the request. If any component handle this request it will return a result property in the event's details object. It's a promise that will resolve itself when the database operation succeed or reject if fails. If any required parameter is not set then the details object will result with error set to true and message property with the error message.

This operation will trigger request-object-changed event.

Event's detail properties

Property name Property type Description
dbName String Name of the data store to perform an operation on.
name String New name of the object
request Object Full request object (with rev and id). It's optional if id property is set
id String Id of the request. It's optional if the request property is set. When using id it will override newest version of the document in the data store

request-object-change

Fired when some element requested to change a request. If any component handle this request it will return a result property in the event's details object. It's a promise that will resolve itself when the database operation succeed or reject if fails. If any required parameter is not set then the details object will result with error set to true and message property with the error message.

This operation will trigger request-object-changed event.

Event's detail properties

Property name Property type Description
dbName String Name of the data store to perform an operation on.
request Object Full request object (with rev and id).

request-object-changed

Event fired when the request has been changed and changes has been saved in the data store.

Event's detail properties

Property name Property type Description
oldRev String The rev before the change.
request Object Updated request object. It will contain updated rev property.

request-objects-cleared

Fired when the data store of the requests has been cleared from all entries. Practically the data store has been removed.

Event's detail properties

Property name Property type Description
type String Can be one of saved, history and external

open-drive

Fired when any component requested open a file from the Google Drive.

This event do not require any details.

project-name-changed

Fired when the name of the project has changed.

Event's detail properties

Property name Property type Description
projectId String The ID of the project
name String New name
project Object The project object