This commit is contained in:
tamaina
2021-02-17 02:20:45 +09:00
parent 2dc4f24f18
commit c0e9cc1902
6 changed files with 97 additions and 53 deletions

View File

@@ -61,7 +61,12 @@ export async function openPost(options: any, loginId: string) {
export async function openClient(order: swMessageOrderType, url: string, loginId: string, query: any = {}) {
const client = await self.clients.matchAll({
type: 'window'
}).then(clients => clients.length > 0 ? clients[0] as WindowClient : null);
}).then(clients => {
for (const c of clients) {
if (c.url.indexOf('?zen') < 0) return c;
}
return null;
});
if (client) {
client.postMessage({ type: 'order', ...query, order, loginId, url } as SwMessage);