mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-12 11:23:52 +02:00
Support custom instance names
This commit is contained in:
@@ -21,6 +21,35 @@ const instanceReq = {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {{worldId: string, instanceId: string}} params
|
||||
* @returns {Promise<{json: any, ref: any, cache?: boolean, params}>}
|
||||
*/
|
||||
getCachedInstance(params) {
|
||||
const instanceStore = useInstanceStore();
|
||||
return new Promise((resolve, reject) => {
|
||||
const ref = instanceStore.cachedInstances.get(
|
||||
`${params.worldId}:${params.instanceId}`
|
||||
);
|
||||
if (typeof ref === 'undefined') {
|
||||
instanceReq
|
||||
.getInstance(params)
|
||||
.then((args) => {
|
||||
args.ref = instanceStore.applyInstance(args.json);
|
||||
resolve(args);
|
||||
})
|
||||
.catch(reject);
|
||||
} else {
|
||||
resolve({
|
||||
cache: true,
|
||||
json: ref,
|
||||
params,
|
||||
ref
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @type {import('../types/api/instance').CreateInstance}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user