webtalekit-alpha 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -0
- package/engineConfig.json +10 -0
- package/package.json +49 -0
- package/parser/cli.js +61 -0
- package/parser/parser.js +53 -0
- package/src/core/drawer.js +399 -0
- package/src/core/drawer.js.map +1 -0
- package/src/core/index.js +654 -0
- package/src/core/resourceManager.js +19 -0
- package/src/core/resourceManager.js.map +1 -0
- package/src/core/scenarioManager.js +107 -0
- package/src/core/scenarioManager.js.map +1 -0
- package/src/resource/ImageObject.js +152 -0
- package/src/resource/ImageObject.js.map +1 -0
- package/src/resource/soundObject.js +146 -0
- package/src/resource/soundObject.js.map +1 -0
- package/src/utils/logger.js +75 -0
- package/src/utils/logger.js.map +1 -0
- package/src/utils/store.js +28 -0
- package/src/utils/store.js.map +1 -0
- package/src/utils/waitUtil.js +48 -0
- package/src/utils/waitUtil.js.map +1 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.ScenarioManager = void 0;
|
|
24
|
+
var ImageObject_1 = require("../resource/ImageObject");
|
|
25
|
+
var logger_1 = require("../utils/logger");
|
|
26
|
+
var ScenarioManager = /** @class */ (function () {
|
|
27
|
+
function ScenarioManager() {
|
|
28
|
+
this.background = new ImageObject_1.ImageObject();
|
|
29
|
+
this.backlist = [];
|
|
30
|
+
this.saveDataList = [];
|
|
31
|
+
this.progress = {
|
|
32
|
+
currentBackground: '',
|
|
33
|
+
currentScene: '',
|
|
34
|
+
currentIndex: 0,
|
|
35
|
+
selected: {
|
|
36
|
+
// '{scene名}':[id]
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
ScenarioManager.prototype.setScenario = function (scenario, sceneName) {
|
|
41
|
+
if (sceneName === void 0) { sceneName = ''; }
|
|
42
|
+
(0, logger_1.outputLog)('call', 'debug', { scenario: scenario, sceneName: sceneName });
|
|
43
|
+
this.scenarioData = scenario;
|
|
44
|
+
this.progress.currentScene = sceneName;
|
|
45
|
+
this.progress.currentIndex = 0;
|
|
46
|
+
};
|
|
47
|
+
ScenarioManager.prototype.addScenario = function (scenario, index) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
// 区別にsub=trueを追加
|
|
50
|
+
var _scenario = scenario.map(function (item) { return (__assign(__assign({}, item), { sub: true })); });
|
|
51
|
+
(0, logger_1.outputLog)('call', 'debug', { scenario: scenario, index: index });
|
|
52
|
+
// index指定がある場合はその値に挿入する
|
|
53
|
+
if (index) {
|
|
54
|
+
(_a = this.scenarioData).splice.apply(_a, __spreadArray([index, 0], _scenario, false));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// 現在の位置に挿入する
|
|
58
|
+
(_b = this.scenarioData).splice.apply(_b, __spreadArray([this.progress.currentIndex, 0], _scenario, false));
|
|
59
|
+
}
|
|
60
|
+
(0, logger_1.outputLog)('call', 'debug', this.scenarioData);
|
|
61
|
+
};
|
|
62
|
+
ScenarioManager.prototype.getScenario = function () {
|
|
63
|
+
return this.scenarioData;
|
|
64
|
+
};
|
|
65
|
+
ScenarioManager.prototype.next = function () {
|
|
66
|
+
(0, logger_1.outputLog)('call: index:', 'debug', this.progress.currentIndex);
|
|
67
|
+
if (this.progress.currentIndex <= this.scenarioData.length) {
|
|
68
|
+
var nextScenario = this.scenarioData[this.progress.currentIndex];
|
|
69
|
+
this.progress.currentIndex += 1;
|
|
70
|
+
return nextScenario;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
ScenarioManager.prototype.hasNext = function () {
|
|
77
|
+
return this.progress.currentIndex < this.scenarioData.length;
|
|
78
|
+
};
|
|
79
|
+
ScenarioManager.prototype.getIndex = function () {
|
|
80
|
+
return this.progress.currentIndex;
|
|
81
|
+
};
|
|
82
|
+
ScenarioManager.prototype.setIndex = function (index) {
|
|
83
|
+
(0, logger_1.outputLog)('call index:', 'debug', index);
|
|
84
|
+
this.progress.currentIndex = index;
|
|
85
|
+
};
|
|
86
|
+
ScenarioManager.prototype.setSceneName = function (sceneName) {
|
|
87
|
+
this.progress.currentScene = sceneName;
|
|
88
|
+
};
|
|
89
|
+
ScenarioManager.prototype.getSceneName = function () {
|
|
90
|
+
return this.progress.currentScene;
|
|
91
|
+
};
|
|
92
|
+
ScenarioManager.prototype.setHistory = function (text) {
|
|
93
|
+
this.backlist.push(text);
|
|
94
|
+
};
|
|
95
|
+
ScenarioManager.prototype.setSelectedChoice = function (prompt, id) {
|
|
96
|
+
this.progress.selected[this.progress.currentScene] = { prompt: prompt, id: id };
|
|
97
|
+
};
|
|
98
|
+
ScenarioManager.prototype.setBackground = function (image) {
|
|
99
|
+
this.background = image;
|
|
100
|
+
};
|
|
101
|
+
ScenarioManager.prototype.getBackground = function () {
|
|
102
|
+
return this.background;
|
|
103
|
+
};
|
|
104
|
+
return ScenarioManager;
|
|
105
|
+
}());
|
|
106
|
+
exports.ScenarioManager = ScenarioManager;
|
|
107
|
+
//# sourceMappingURL=scenarioManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenarioManager.js","sourceRoot":"","sources":["../../../src/core/scenarioManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAqD;AACrD,0CAA2C;AAC3C;IAQE;QAHQ,eAAU,GAAgB,IAAI,yBAAW,EAAE,CAAA;QAIjD,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAA;QAClB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG;YACd,iBAAiB,EAAE,EAAE;YACrB,YAAY,EAAE,EAAE;YAChB,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE;YACR,kBAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAED,qCAAW,GAAX,UAAa,QAAa,EAAE,SAAoB;QAApB,0BAAA,EAAA,cAAoB;QAC9C,IAAA,kBAAS,EAAC,MAAM,EAAC,OAAO,EAAE,EAAC,QAAQ,UAAA,EAAE,SAAS,WAAA,EAAC,CAAC,CAAA;QAChD,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAA;QAC5B,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,SAAS,CAAA;QACtC,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,qCAAW,GAAX,UAAa,QAAa,EAAE,KAAa;;QACvC,iBAAiB;QACjB,IAAM,SAAS,GAAI,QAAQ,CAAC,GAAG,CAAC,UAAC,IAAS,IAAK,OAAA,uBAAM,IAAI,KAAE,GAAG,EAAE,IAAI,IAAG,EAAxB,CAAwB,CAAC,CAAA;QACxE,IAAA,kBAAS,EAAC,MAAM,EAAC,OAAO,EAAE,EAAC,QAAQ,UAAA,EAAE,KAAK,OAAA,EAAC,CAAC,CAAA;QAC5C,wBAAwB;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AAG,KAAK,CAAA;IACpC,CAAC;IAED,sCAAY,GAAZ,UAAa,SAAiB;QAC5B,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,SAAS,CAAA;IACxC,CAAC;IAED,sCAAY,GAAZ;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAA;IACnC,CAAC;IAED,oCAAU,GAAV,UAAY,IAAY;QACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,2CAAiB,GAAjB,UAAmB,MAAa,EAAE,EAAS;QACzC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAC,MAAM,QAAA,EAAE,EAAE,IAAA,EAAC,CAAA;IACnE,CAAC;IAED,uCAAa,GAAb,UAAc,KAAkB;QAC/B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;IACxB,CAAC;IAED,uCAAa,GAAb;QACE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IACH,sBAAC;AAAD,CAAC,AA7FD,IA6FC;AA7FY,0CAAe"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ImageObject = void 0;
|
|
40
|
+
var ImageObject = /** @class */ (function () {
|
|
41
|
+
function ImageObject() {
|
|
42
|
+
// 表示済みの画像を管理するクラス
|
|
43
|
+
this.image = null;
|
|
44
|
+
this.filter = [];
|
|
45
|
+
// 画像の読み込みと表示処理
|
|
46
|
+
this.image = new Image();
|
|
47
|
+
this.canvas = document.createElement('canvas');
|
|
48
|
+
this.ctx = this.canvas.getContext('2d');
|
|
49
|
+
}
|
|
50
|
+
ImageObject.prototype.getImage = function () {
|
|
51
|
+
return this.image;
|
|
52
|
+
};
|
|
53
|
+
ImageObject.prototype.setImage = function (img) {
|
|
54
|
+
// 画像の読み込みと表示処理
|
|
55
|
+
this.image = img;
|
|
56
|
+
return this;
|
|
57
|
+
};
|
|
58
|
+
ImageObject.prototype.getCanvas = function () {
|
|
59
|
+
return this.canvas;
|
|
60
|
+
};
|
|
61
|
+
ImageObject.prototype.setCanvas = function (canvas) {
|
|
62
|
+
this.canvas = canvas;
|
|
63
|
+
return this;
|
|
64
|
+
};
|
|
65
|
+
ImageObject.prototype.getSize = function () {
|
|
66
|
+
return { width: this.image.width, height: this.image.height };
|
|
67
|
+
};
|
|
68
|
+
ImageObject.prototype.setImageAsync = function (src) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var _this = this;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
if (!src || src.length == 0) {
|
|
73
|
+
return [2 /*return*/, this];
|
|
74
|
+
}
|
|
75
|
+
// 画像の読み込みと表示処理
|
|
76
|
+
this.image.src = src;
|
|
77
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
78
|
+
_this.image.onload = function () {
|
|
79
|
+
_this.canvas.width = _this.image.width;
|
|
80
|
+
_this.canvas.height = _this.image.height;
|
|
81
|
+
resolve(_this);
|
|
82
|
+
};
|
|
83
|
+
_this.image.onError = function () {
|
|
84
|
+
reject(new Error('画像の読み込みに失敗しました'));
|
|
85
|
+
};
|
|
86
|
+
})];
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
ImageObject.prototype.draw = function (reverse) {
|
|
91
|
+
if (reverse === void 0) { reverse = false; }
|
|
92
|
+
if (reverse) {
|
|
93
|
+
this.ctx.save();
|
|
94
|
+
this.ctx.scale(-1, 1);
|
|
95
|
+
this.ctx.drawImage(this.image, -this.image.width, 0);
|
|
96
|
+
this.ctx.restore();
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.ctx.drawImage(this.image, 0, 0);
|
|
100
|
+
}
|
|
101
|
+
return this;
|
|
102
|
+
};
|
|
103
|
+
// 画像の透明度を変更
|
|
104
|
+
ImageObject.prototype.setOpacity = function (opacity) {
|
|
105
|
+
this.ctx.drawImage(this.image, 0, 0);
|
|
106
|
+
// 透明度を設定
|
|
107
|
+
this.ctx.globalAlpha = opacity;
|
|
108
|
+
return this;
|
|
109
|
+
};
|
|
110
|
+
// アニメーション(フェードイン/フェードアウト)
|
|
111
|
+
// セピア化
|
|
112
|
+
ImageObject.prototype.setSepia = function (num) {
|
|
113
|
+
if (num === void 0) { num = 100; }
|
|
114
|
+
this.ctx.drawImage(this.image, 0, 0);
|
|
115
|
+
// フィルターをかける
|
|
116
|
+
this.filter.push("sepia(".concat(num, "%)"));
|
|
117
|
+
this.ctx.filter = this.filter.join(' ');
|
|
118
|
+
// 画像データを取得
|
|
119
|
+
return this.draw();
|
|
120
|
+
};
|
|
121
|
+
// モノクロ化
|
|
122
|
+
ImageObject.prototype.setMonochrome = function (num) {
|
|
123
|
+
if (num === void 0) { num = 100; }
|
|
124
|
+
this.ctx.drawImage(this.image, 0, 0);
|
|
125
|
+
// フィルターをかける
|
|
126
|
+
this.filter.push("grayscale(".concat(num, "%)"));
|
|
127
|
+
this.ctx.filter = this.filter.join(' ');
|
|
128
|
+
// 画像データを取得
|
|
129
|
+
return this.draw();
|
|
130
|
+
};
|
|
131
|
+
// ぼかし
|
|
132
|
+
ImageObject.prototype.setBlur = function (num) {
|
|
133
|
+
if (num === void 0) { num = 2; }
|
|
134
|
+
this.ctx.drawImage(this.image, 0, 0);
|
|
135
|
+
// フィルターをかける
|
|
136
|
+
this.filter.push("blur(".concat(num, "px)"));
|
|
137
|
+
this.ctx.filter = this.filter.join(' ');
|
|
138
|
+
// 画像データを取得
|
|
139
|
+
return this.draw();
|
|
140
|
+
};
|
|
141
|
+
// フィルターの解除
|
|
142
|
+
ImageObject.prototype.clearFilter = function () {
|
|
143
|
+
this.ctx.drawImage(this.image, 0, 0);
|
|
144
|
+
// フィルターをかける
|
|
145
|
+
this.ctx.filter = 'none';
|
|
146
|
+
// 画像データを取得
|
|
147
|
+
return this.draw();
|
|
148
|
+
};
|
|
149
|
+
return ImageObject;
|
|
150
|
+
}());
|
|
151
|
+
exports.ImageObject = ImageObject;
|
|
152
|
+
//# sourceMappingURL=ImageObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageObject.js","sourceRoot":"","sources":["../../../src/resource/ImageObject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;IAOE;QANA,kBAAkB;QACV,UAAK,GAAQ,IAAI,CAAA;QAGjB,WAAM,GAAa,EAAE,CAAA;QAG3B,eAAe;QACf,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QAC9C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAA6B,CAAA;IACrE,CAAC;IAED,8BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,8BAAQ,GAAR,UAAS,GAAqB;QAC5B,eAAe;QACf,IAAI,CAAC,KAAK,GAAG,GAAG,CAAA;QAChB,OAAO,I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AAC,oBAAa,GAAG,OAAI,CAAC,CAAA;QACtC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACvC,WAAW;QACX,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;IAED,MAAM;IACN,6BAAO,GAAP,UAAQ,GAAO;QAAP,oBAAA,EAAA,OAAO;QACb,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACpC,YAAY;QACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAQ,GAAG,QAAK,CAAC,CAAA;QAClC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACvC,WAAW;QACX,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;IAED,WAAW;IACX,iCAAW,GAAX;QACE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACpC,YAAY;QACZ,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAA;QACxB,WAAW;QACX,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;IACH,kBAAC;AAAD,CAAC,AAnHD,IAmHC;AAnHY,kCAAW"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.SoundObject = void 0;
|
|
40
|
+
var SoundObject = /** @class */ (function () {
|
|
41
|
+
function SoundObject() {
|
|
42
|
+
// 表示済みの画像を管理するクラス
|
|
43
|
+
this.audio = null;
|
|
44
|
+
this.ctx = new AudioContext();
|
|
45
|
+
this.source = this.ctx.createBufferSource();
|
|
46
|
+
this.isPlaying = false;
|
|
47
|
+
this.ctx = new AudioContext();
|
|
48
|
+
}
|
|
49
|
+
SoundObject.prototype.getAudio = function () {
|
|
50
|
+
return this.audio;
|
|
51
|
+
};
|
|
52
|
+
SoundObject.prototype.setAudio = function (track) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
var _a, source;
|
|
55
|
+
return __generator(this, function (_b) {
|
|
56
|
+
switch (_b.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
// 画像の読み込みと表示処理
|
|
59
|
+
_a = this;
|
|
60
|
+
return [4 /*yield*/, this.ctx.decodeAudioData(track)];
|
|
61
|
+
case 1:
|
|
62
|
+
// 画像の読み込みと表示処理
|
|
63
|
+
_a.audio = _b.sent();
|
|
64
|
+
source = this.ctx.createBufferSource();
|
|
65
|
+
source.buffer = this.audio;
|
|
66
|
+
source.connect(this.ctx.destination);
|
|
67
|
+
return [2 /*return*/, this];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
SoundObject.prototype.getContext = function () {
|
|
73
|
+
return this.ctx;
|
|
74
|
+
};
|
|
75
|
+
SoundObject.prototype.setContext = function (context) {
|
|
76
|
+
this.ctx = context;
|
|
77
|
+
return this;
|
|
78
|
+
};
|
|
79
|
+
SoundObject.prototype.getFileInfo = function () {
|
|
80
|
+
// return filename, fileSize, playTime
|
|
81
|
+
return;
|
|
82
|
+
};
|
|
83
|
+
SoundObject.prototype.setAudioAsync = function (src) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
+
var arrayBuffer, _a;
|
|
86
|
+
return __generator(this, function (_b) {
|
|
87
|
+
switch (_b.label) {
|
|
88
|
+
case 0:
|
|
89
|
+
if (!src || src.length == 0) {
|
|
90
|
+
return [2 /*return*/, this];
|
|
91
|
+
}
|
|
92
|
+
return [4 /*yield*/, fetch(src)];
|
|
93
|
+
case 1: return [4 /*yield*/, (_b.sent()).arrayBuffer()];
|
|
94
|
+
case 2:
|
|
95
|
+
arrayBuffer = _b.sent();
|
|
96
|
+
_a = this;
|
|
97
|
+
return [4 /*yield*/, this.ctx.decodeAudioData(arrayBuffer)];
|
|
98
|
+
case 3:
|
|
99
|
+
_a.audio = _b.sent();
|
|
100
|
+
return [2 /*return*/, this];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
// music control
|
|
106
|
+
SoundObject.prototype.play = function (loop) {
|
|
107
|
+
var _this = this;
|
|
108
|
+
if (this.isPlaying) {
|
|
109
|
+
this.stop();
|
|
110
|
+
}
|
|
111
|
+
if (!this.audio) {
|
|
112
|
+
console.error('No audio loaded');
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.source = this.ctx.createBufferSource();
|
|
116
|
+
this.source.buffer = this.audio;
|
|
117
|
+
this.source.connect(this.ctx.destination);
|
|
118
|
+
this.source.loop = loop;
|
|
119
|
+
this.source.start(0);
|
|
120
|
+
this.isPlaying = true;
|
|
121
|
+
this.source.onended = function () {
|
|
122
|
+
var _a;
|
|
123
|
+
if (!((_a = _this.source) === null || _a === void 0 ? void 0 : _a.loop)) {
|
|
124
|
+
_this.isPlaying = false;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
SoundObject.prototype.stop = function () {
|
|
129
|
+
if (this.source && this.isPlaying) {
|
|
130
|
+
this.source.stop();
|
|
131
|
+
this.source.disconnect();
|
|
132
|
+
this.source = null;
|
|
133
|
+
this.isPlaying = false;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
Object.defineProperty(SoundObject.prototype, "playing", {
|
|
137
|
+
get: function () {
|
|
138
|
+
return this.isPlaying;
|
|
139
|
+
},
|
|
140
|
+
enumerable: false,
|
|
141
|
+
configurable: true
|
|
142
|
+
});
|
|
143
|
+
return SoundObject;
|
|
144
|
+
}());
|
|
145
|
+
exports.SoundObject = SoundObject;
|
|
146
|
+
//# sourceMappingURL=soundObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soundObject.js","sourceRoot":"","sources":["../../../src/resource/soundObject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;IAOE;QANA,kBAAkB;QACV,UAAK,GAAQ,IAAI,CAAA;QACjB,QAAG,GAAiB,IAAI,YAAY,EAAE,CAAA;QACvC,WAAM,GAAiC,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAA;QACnE,cAAS,GAAY,KAAK,CAAA;QAGhC,IAAI,CAAC,GAAG,GAAG,IAAI,YAAY,EAAE,CAAA;IAC/B,CAAC;IAED,8BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAEK,8BAAQ,GAAd,UAAe,KAAkB;;;;;;wBAC/B,eAAe;wBACf,KAAA,IAAI,CAAA;wBAAS,qBAAM,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,EAAA;;wBADlD,eAAe;wBACf,GAAK,KAAK,GAAG,SAAqC,CAAA;wBAC5C,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAA;wBAC5C,MAAM,CAAC,MAAM,GAAG,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;QAC/B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;QACzC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAEpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QAErB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG;;YACpB,IAAI,CAAC,CAAA,MAAA,KAAI,CAAC,MAAM,0CAAE,IAAI,CAAA,EAAE,CAAC;gBACvB,KAAI,CAAC,SAAS,GAAG,KAAK,CAAA;YACxB,CAAC;QACH,CAAC,CAAA;IACH,CAAC;IAED,0BAAI,GAAJ;QACE,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;YAClB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;YACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;YAClB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;QACxB,CAAC;IACH,CAAC;IAED,sBAAI,gCAAO;aAAX;YACE,OAAO,IAAI,CAAC,SAAS,CAAA;QACvB,CAAC;;;OAAA;IAGH,kBAAC;AAAD,CAAC,AAtFD,IAsFC;AAtFY,kCAAW"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.outputLog = outputLog;
|
|
43
|
+
var stacktrace_js_1 = __importDefault(require("stacktrace-js"));
|
|
44
|
+
function outputLog() {
|
|
45
|
+
return __awaiter(this, arguments, void 0, function (msg, level, option) {
|
|
46
|
+
var stack, caller, callerText, error_1;
|
|
47
|
+
if (msg === void 0) { msg = 'None'; }
|
|
48
|
+
if (level === void 0) { level = 'log'; }
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
if (!['log', 'debug', 'warn', 'error'].includes(level)) {
|
|
53
|
+
level = 'log';
|
|
54
|
+
}
|
|
55
|
+
_a.label = 1;
|
|
56
|
+
case 1:
|
|
57
|
+
_a.trys.push([1, 3, , 4]);
|
|
58
|
+
return [4 /*yield*/, stacktrace_js_1.default.get()];
|
|
59
|
+
case 2:
|
|
60
|
+
stack = _a.sent();
|
|
61
|
+
caller = stack[1];
|
|
62
|
+
callerText = "".concat(caller.functionName, ":").concat(caller.lineNumber, ":").concat(caller.columnNumber);
|
|
63
|
+
// prettier-ignore
|
|
64
|
+
console[level](level.toUpperCase(), callerText, msg, option || '');
|
|
65
|
+
return [3 /*break*/, 4];
|
|
66
|
+
case 3:
|
|
67
|
+
error_1 = _a.sent();
|
|
68
|
+
console.error('Error getting stack trace:', error_1);
|
|
69
|
+
return [3 /*break*/, 4];
|
|
70
|
+
case 4: return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,8BAcC;AAlBD,gEAAuC;AAIvC,SAAsB,SAAS;wDAAC,GAAoB,EAAE,KAAuB,EAAE,MAAY;;QAA3D,oBAAA,EAAA,YAAoB;QAAE,sBAAA,EAAA,aAAuB;;;;oBAC3E,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;wBACvD,KAAK,GAAG,KAAK,CAAC;oBAChB,CAAC;;;;oBAGe,qBAAM,uBAAU,CAAC,GAAG,EAAE,EAAA;;oBAA9B,KAAK,GAAG,SAAsB;oBAC9B,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;oBAClB,UAAU,GAAG,UAAG,MAAM,CAAC,YAAY,cAAI,MAAM,CAAC,UAAU,cAAI,MAAM,CAAC,YAAY,CAAE,CAAC;oBACxF,kBAAkB;oBAClB,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;;;;oBAEnE,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,OAAK,CAAC,CAAC;;;;;;CAEtD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.generateStore = void 0;
|
|
18
|
+
var storejs_1 = __importDefault(require("storejs"));
|
|
19
|
+
var generateStore = function () {
|
|
20
|
+
var allData = (0, storejs_1.default)();
|
|
21
|
+
var store = __assign(__assign({}, allData), { set: function (key, value) {
|
|
22
|
+
storejs_1.default.set(key, value);
|
|
23
|
+
this[key] = value;
|
|
24
|
+
} });
|
|
25
|
+
return store;
|
|
26
|
+
};
|
|
27
|
+
exports.generateStore = generateStore;
|
|
28
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/utils/store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAA8B;AAUvB,IAAM,aAAa,GAAG;IAC3B,IAAM,OAAO,GAAc,IAAA,iBAAO,GAAE,CAAC;IAErC,IAAM,KAAK,yBACN,OAAO,KACV,GAAG,YAAC,GAAW,EAAE,KAAU;YACzB,iBAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACpB,CAAC,GACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAA;AAZY,QAAA,aAAa,iBAYzB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.sleep = sleep;
|
|
40
|
+
// sleep関数
|
|
41
|
+
function sleep(ms) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, ms); })];
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=waitUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitUtil.js","sourceRoot":"","sources":["../../../src/utils/waitUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sBAEC;AAHD,UAAU;AACV,SAAsB,KAAK,CAAC,EAAU;;;YACpC,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO,IAAK,OAAA,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,EAAvB,CAAuB,CAAC,EAAC;;;CAC1D"}
|