ydn.db.events
Module ydn.db.events
has three event classes. The event
object are closely follow DOM
Event model. The events are dispatched by a storage
instance and listen by addEventListener.
Classes
ydn.db.events.RecordEvent
RecordEvent
are dispatched
when changes in a record.
RecordEvent
are dispatched
when changes in a record. - Fields:
- {string} name
- Event name. The value is 'RecordEvent'.
- {string} type
- Event type. The value could be one of 'created', 'deleted' or 'updated'.
- Methods:
- {string} getStoreName()
- Return effected store name.
- {*} getKey()
- Return effected key.
- {*} getValue()
- Return record value used.
ydn.db.events.StorageEvent
StorageEvent
are dispatched
for changes in database connection.
StorageEvent
are dispatched
for changes in database connection. - Fields:
- {string} name
- Event name. The value is 'StorageEvent'.
- {string} type
- Event type.
- Methods:
- {number} getVersion()
- Get database schema version. This is
NaN
if not connected. - {number} getOldVersion()
- Get previous database schema version if upgraded.
ydn.db.events.StorageErrorEvent
StorageEvent
are dispatched
when fatal error occour.
StorageEvent
are dispatched
when fatal error occour. - Fields:
- {string} name
- Event name. The value is 'StorageErrorEvent'.
- {string} type
- Event type.
- Methods:
- {?Error} getError()
- Get error.
null
if no error occur.
ydn.db.events.StoreEvent
StoreEvent
are dispatched when
changes in a store.
StoreEvent
are dispatched when
changes in a store. - Fields:
- {string} name
- Event name. The value is 'StoreEvent'.
- {string} type
- Event type. The value could be one of 'created', 'deleted' or 'updated'.
- Methods:
- {string} getStoreName()
- Return effected store name.
- {!Array} getKeys()
- Return effected keys.
- {!Array} getValues()
- Return record values used.