aboutsummaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-16 11:59:17 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-16 12:00:56 -0500
commit42f1c2463c8051d9cbbcacd43f06922c2f11ec71 (patch)
treedfd3f2096bbd84704b52c942b231b5f19895f0f1 /ext/fg
parent912d59d3dfefde5738b4244d74d944795edcc02c (diff)
Move generateId function
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/frontend-api-sender.js10
1 files changed, 1 insertions, 9 deletions
diff --git a/ext/fg/js/frontend-api-sender.js b/ext/fg/js/frontend-api-sender.js
index 93c2e593..8dc6aaf3 100644
--- a/ext/fg/js/frontend-api-sender.js
+++ b/ext/fg/js/frontend-api-sender.js
@@ -19,7 +19,7 @@
class FrontendApiSender {
constructor() {
- this.senderId = FrontendApiSender.generateId(16);
+ this.senderId = yomichan.generateId(16);
this.ackTimeout = 3000; // 3 seconds
this.responseTimeout = 10000; // 10 seconds
this.callbacks = new Map();
@@ -123,12 +123,4 @@ class FrontendApiSender {
info.timer = null;
info.reject(new Error(reason));
}
-
- static generateId(length) {
- let id = '';
- for (let i = 0; i < length; ++i) {
- id += Math.floor(Math.random() * 256).toString(16).padStart(2, '0');
- }
- return id;
- }
}