added public_libraries

This commit is contained in:
SrGooglo 2024-01-25 00:37:25 +01:00
parent 57bf2c58e8
commit 63f247a5ac
3 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,7 @@
import MCL from "./mcl"
import RendererIPC from "./renderer_ipc"
export default {
mcl: MCL,
ipc: RendererIPC,
}

View File

@ -0,0 +1,34 @@
import Client from "../../lib/mcl/launcher"
import Authenticator from "../../lib/mcl/authenticator"
export default class MCL {
/**
* Asynchronously authenticate the user using the provided username and password.
*
* @param {string} username - the username of the user
* @param {string} password - the password of the user
* @return {Promise<Object>} the authentication information
*/
static async auth(username, password) {
return await Authenticator.getAuth(username, password)
}
/**
* Launches a new client with the given options.
*
* @param {Object} opts - The options to be passed for launching the client.
* @return {Promise<Client>} A promise that resolves with the launched client.
*/
static async launch(opts, callbacks) {
const launcher = new Client()
launcher.on("debug", (e) => console.log(e))
launcher.on("data", (e) => console.log(e))
launcher.on("close", (e) => console.log(e))
launcher.on("error", (e) => console.log(e))
await launcher.launch(opts, callbacks)
return launcher
}
}

View File

@ -0,0 +1,7 @@
import sendToRender from "../../utils/sendToRender"
export default class RendererIPC {
static async send(...args) {
return await sendToRender(...args)
}
}