26 lines
814 B
JavaScript
26 lines
814 B
JavaScript
(function (root, factory) {
|
|
if (typeof module === 'object' && module.exports) module.exports = factory;
|
|
else root.createMobileQueueLauncher = factory;
|
|
})(typeof self !== 'undefined' ? self : this, function createMobileQueueLauncher(options) {
|
|
const emptyMessages = {
|
|
attention: 'No items need attention.',
|
|
update: 'No unread updates are ready to open.',
|
|
later: 'No deferred work is ready to open.',
|
|
draft: 'No drafts are ready to open.',
|
|
};
|
|
|
|
function open(name) {
|
|
if (name === 'today') return options.openToday();
|
|
options.selectFilter(name);
|
|
const action = options.firstAction(name);
|
|
if (!action) {
|
|
options.announce(emptyMessages[name] || 'No work is ready to open.');
|
|
return 'empty';
|
|
}
|
|
action.click();
|
|
return 'opened';
|
|
}
|
|
|
|
return { open };
|
|
});
|