[fix] pluginApi not compiled

This commit is contained in:
kwaroran
2023-05-08 00:49:02 +09:00
parent ea03a1f17a
commit 30fc620385

View File

@@ -1,3 +1,14 @@
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -34,12 +45,43 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __risuPlugin__ = {
(function () {
var __risuPlugin__ = {
providers: [],
fetchResponseQueue: []
};
var sleep = function (ms) { return new Promise(function (r) { return setTimeout(r, ms); }); };
function risuFetch(url, arg) {
};
var sleep = function (ms) { return new Promise(function (r) { return setTimeout(r, ms); }); };
function transferDataAsync(type, body) {
return __awaiter(this, void 0, void 0, function () {
var id, i, q;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
id = "".concat(Date.now(), "_").concat(Math.random());
postMessage({
type: 'fetch',
body: __assign({ id: id }, body)
});
_a.label = 1;
case 1:
if (!true) return [3 /*break*/, 3];
return [4 /*yield*/, sleep(50)];
case 2:
_a.sent();
for (i = 0; i < __risuPlugin__.fetchResponseQueue.length; i++) {
q = __risuPlugin__.fetchResponseQueue[i];
if (q.id === id) {
__risuPlugin__.fetchResponseQueue.splice(i, 1);
return [2 /*return*/, q.data];
}
}
return [3 /*break*/, 1];
case 3: return [2 /*return*/];
}
});
});
}
function risuFetch(url, arg) {
return __awaiter(this, void 0, void 0, function () {
var id, i, q;
return __generator(this, function (_a) {
@@ -72,8 +114,8 @@ function risuFetch(url, arg) {
}
});
});
}
function getArg(arg) {
}
function getArg(arg) {
return __awaiter(this, void 0, void 0, function () {
var id, i, q;
return __generator(this, function (_a) {
@@ -105,8 +147,8 @@ function getArg(arg) {
}
});
});
}
function addProvider(name, func) {
}
function addProvider(name, func) {
postMessage({
type: 'addProvider',
body: name
@@ -115,14 +157,23 @@ function addProvider(name, func) {
name: name,
func: func
});
}
function printLog(data) {
}
function printLog(data) {
postMessage({
type: 'log',
body: data
});
}
function handleOnmessage(data) {
}
function getChar() {
return transferDataAsync('getChar', '');
}
function setChar(char) {
postMessage({
type: 'setChar',
body: char
});
}
function handleOnmessage(data) {
return __awaiter(this, void 0, void 0, function () {
var _a, body, providers, providerfunc, _i, providers_1, provider, _b, error_1;
var _c;
@@ -189,8 +240,14 @@ function handleOnmessage(data) {
}
});
});
}
onmessage = function (ev) {
}
onmessage = function (ev) {
handleOnmessage(ev.data);
var data = ev.data;
};
};
{
var __risuPlugin__1 = null;
var transferDataAsync_1 = null;
//{{placeholder}}
}
})();