You've already forked AstralRinth
forked from didirus/AstralRinth
* Search updates * fixes2 * Some more work * start instance page wiring * Pack installation + Profile viewing * Remove print statement * Fix disappearing profiles * fix compile err * Finish Instance Running * remove print statement * fix prettier * Fix clippy + early return
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
/**
|
|
* All theseus API calls return serialized values (both return values and errors);
|
|
* So, for example, addDefaultInstance creates a blank Profile object, where the Rust struct is serialized,
|
|
* and deserialized into a usable JS object.
|
|
*/
|
|
import { invoke } from '@tauri-apps/api/tauri'
|
|
|
|
// Add empty default instance
|
|
export async function addDefaultInstance() {
|
|
return await invoke('profile_create_empty')
|
|
}
|
|
|
|
/// Add empty default instance
|
|
/// Returns a path to the profile created
|
|
export async function create() {
|
|
return await invoke('profile_create')
|
|
}
|
|
|
|
// Remove a profile
|
|
export async function remove(path) {
|
|
return await invoke('profile_remove', { path })
|
|
}
|
|
|
|
// Get a profile by path
|
|
// Returns a Profile
|
|
export async function get(path) {
|
|
return await invoke('profile_get', { path })
|
|
}
|
|
|
|
// Get a copy of the profile set
|
|
// Returns hashmap of path -> Profile
|
|
export async function list() {
|
|
return await invoke('profile_list')
|
|
}
|
|
|
|
// Run Minecraft using a pathed profile
|
|
// Returns PID of child
|
|
export async function run(path) {
|
|
return await invoke('profile_run', { path })
|
|
}
|
|
|
|
// Run Minecraft using a pathed profile
|
|
// Waits for end
|
|
export async function run_wait(path) {
|
|
return await invoke('profile_run_wait', { path })
|
|
}
|