mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-07 21:58:27 +02:00
Show local co-op icon in game card
This commit is contained in:
21
src/utils/local-co-op-manager.ts
Normal file
21
src/utils/local-co-op-manager.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { BxEventBus } from "./bx-event-bus";
|
||||
import { GhPagesUtils } from "./gh-pages";
|
||||
|
||||
export class LocalCoOpManager {
|
||||
private static instance: LocalCoOpManager;
|
||||
public static getInstance = () => LocalCoOpManager.instance ?? (LocalCoOpManager.instance = new LocalCoOpManager());
|
||||
|
||||
private supportedIds: string[] = [];
|
||||
|
||||
constructor() {
|
||||
BxEventBus.Script.once('list.localCoOp.updated', e => {
|
||||
this.supportedIds = Object.keys(e.data.data);
|
||||
console.log('supportedIds', this.supportedIds);
|
||||
});
|
||||
GhPagesUtils.getLocalCoOpList();
|
||||
}
|
||||
|
||||
isSupported(productId: string) {
|
||||
return this.supportedIds.includes(productId);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user