mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 10:34:18 +00:00
added public_libraries
This commit is contained in:
parent
57bf2c58e8
commit
63f247a5ac
7
src/main/public_libraries/index.js
Normal file
7
src/main/public_libraries/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import MCL from "./mcl"
|
||||||
|
import RendererIPC from "./renderer_ipc"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mcl: MCL,
|
||||||
|
ipc: RendererIPC,
|
||||||
|
}
|
34
src/main/public_libraries/mcl/index.js
Normal file
34
src/main/public_libraries/mcl/index.js
Normal 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
|
||||||
|
}
|
||||||
|
}
|
7
src/main/public_libraries/renderer_ipc/index.js
Normal file
7
src/main/public_libraries/renderer_ipc/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sendToRender from "../../utils/sendToRender"
|
||||||
|
|
||||||
|
export default class RendererIPC {
|
||||||
|
static async send(...args) {
|
||||||
|
return await sendToRender(...args)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user