-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* version for two clients * change client * change client upd * client select * clear debug * fix client context * remove discord url * revert * selected alt * update import * update client * reactive client * fix selectAlt --------- Co-authored-by: Xinos <userxinos@gmail.com>
- Loading branch information
1 parent
2662560
commit 637c179
Showing
7 changed files
with
118 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
import { Compendium } from 'bot_client'; | ||
import { Compendium as Client1 } from 'bot_client'; | ||
import { Compendium as Client2 } from 'bot_client2'; | ||
import { ref } from 'vue'; | ||
|
||
const clients = [Client1, Client2]; | ||
|
||
const client = new Compendium(); | ||
let initialized = false; | ||
const client = ref<Client1|Client2>(new Client1()); | ||
|
||
const compendiumClient = localStorage.getItem('compendium_client'); | ||
if (compendiumClient) { | ||
switchInstance(parseInt(compendiumClient)); | ||
} | ||
|
||
export default client; | ||
|
||
export async function init() { | ||
if (!initialized) { | ||
await client.initialize(); | ||
await client.value.initialize(); | ||
initialized = true; | ||
} | ||
} | ||
|
||
export function stop() { | ||
client.shutdown(); | ||
client.value.shutdown(); | ||
initialized = false; | ||
} | ||
|
||
export async function switchInstance(clientNum: number) { | ||
stop(); | ||
client.value = new clients[clientNum](); | ||
localStorage.setItem('compendium_client', String(clientNum)); | ||
await init(); | ||
} |
This file was deleted.
Oops, something went wrong.