mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 01:03:50 +02:00
lint: apply pretty import
This commit is contained in:
@@ -1,33 +1,41 @@
|
||||
class InteropApi {
|
||||
constructor() {
|
||||
return new Proxy(this, {
|
||||
get(target, prop) {
|
||||
if (WINDOWS) {
|
||||
return undefined;
|
||||
}
|
||||
// If the property is not a method of InteropApi,
|
||||
// treat it as a .NET class name
|
||||
if (typeof prop === 'string' && !target[prop]) {
|
||||
return new Proxy({}, {
|
||||
get(_, methodName) {
|
||||
// Return a method that calls the .NET method dynamically
|
||||
return async (...args) => {
|
||||
return await target.callMethod(prop, methodName, ...args);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
return target[prop];
|
||||
}
|
||||
});
|
||||
return new Proxy(this, {
|
||||
get(target, prop) {
|
||||
if (WINDOWS) {
|
||||
return undefined;
|
||||
}
|
||||
// If the property is not a method of InteropApi,
|
||||
// treat it as a .NET class name
|
||||
if (typeof prop === 'string' && !target[prop]) {
|
||||
return new Proxy(
|
||||
{},
|
||||
{
|
||||
get(_, methodName) {
|
||||
// Return a method that calls the .NET method dynamically
|
||||
return async (...args) => {
|
||||
return await target.callMethod(
|
||||
prop,
|
||||
methodName,
|
||||
...args
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
return target[prop];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async callMethod(className, methodName, ...args) {
|
||||
return window.interopApi.callDotNetMethod(className, methodName, args)
|
||||
.then(result => {
|
||||
return result;
|
||||
});
|
||||
return window.interopApi
|
||||
.callDotNetMethod(className, methodName, args)
|
||||
.then((result) => {
|
||||
return result;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new InteropApi();
|
||||
export default new InteropApi();
|
||||
|
||||
Reference in New Issue
Block a user