Queue Utilities¶
Source | queue-utilities |
---|
QueueId¶
new QueueId(ensAddress, dispatcher, id, forceReload);
Generates an queue ID by concadinating an ensAddress and a dispatcher name
Parameters¶
ensAddress
-string
: ens address were the dispatcher lives;dispatcher
-string
: name of the exported function on the ens expose object;id
-string
: specification to start the same queue in seperated instances;forceReload
-boolean
: use force reload to disable alert when current opened ens address is the same as the currently finished dispatcher;
Example¶
Reference Implementation: EvanBookmarkService
this.queueId = new QueueId(
this.description.getEvanENSAddress('addressbook'),
'ContactsDispatcher',
'contacts'
);
QueueSequence¶
new QueueSequence(name, description, run);
Used to handle one step of an dispatcher
Parameters¶
name
-string
: Display name for queue (used forQueueDApp
)description
-string
: Description for the queue (used forQueueDApp
)run
-Function
: the function that is called to run the queue (gets the within the QueueDispatcher configured service and the data that should be handled (Array<any>: one entry for each new added QueueEntry))
Returns¶
Promise
returns void
: resolved when done
Example¶
new QueueSequence(
'_dappdapps.dispatcher.save-bookmarks',
'_dappdapps.dispatcher.save-bookmarks-description',
async (service: BookmarkDispatcherService, data: any) => {
await service.bookmarkService.syncQueueBookmarks();
}
)
QueueDispatcher¶
new QueueDispatcher(sequence, i18n, serviceName);
Represents one dispatcher using several queueSequences, that will processed one after another, using step caches
Parameters¶
sequence
-Array<QueueSequence>
: All sequences that should be runned after anotheri18n
-any
: i18n definitions for the queueserviceName
-string
: name of the servide that should be applied to the sequence entry
Example¶
export const BookmarkDispatcher = new QueueDispatcher(
[
sequences...
],
translations
);