Release v2.2.0
This commit is contained in:
1 parent
c643d2fb07
commit
d6417b667c
673 files changed
+146752
-7389
No files matched your search
@@ -0,0 +1,25 @@
|
||||
function createNotifyPlayerScreens(forwardPlayerCommand) {
|
||||
if (typeof forwardPlayerCommand !== 'function') {
|
||||
throw new Error('createNotifyPlayerScreens requires a player command sender.');
|
||||
}
|
||||
|
||||
return function notifyPlayerScreens(slugs, commandOrPayload) {
|
||||
const uniqueSlugs = Array.from(new Set((slugs || []).map(function (slug) {
|
||||
return String(slug || '').trim();
|
||||
}).filter(Boolean)));
|
||||
|
||||
if (!uniqueSlugs.length) {
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
|
||||
return Promise.allSettled(uniqueSlugs.map(function (slug) {
|
||||
return forwardPlayerCommand(slug, commandOrPayload || 'refresh');
|
||||
})).then(function (results) {
|
||||
return results.filter(function (result) {
|
||||
return result.status === 'fulfilled';
|
||||
}).length;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { createNotifyPlayerScreens };
|
||||
Reference in new issue
Block a user