mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 19:37:34 -07:00
refactor: ♻️ no autobind
This commit is contained in:
parent
c3c7a4c6d6
commit
bdaf5e9000
3 changed files with 82 additions and 23 deletions
|
@ -42,7 +42,6 @@
|
|||
"ajv": "8.12.0",
|
||||
"archiver": "5.3.1",
|
||||
"argon2": "^0.30.3",
|
||||
"autobind-decorator": "2.4.0",
|
||||
"autolinker": "4.0.0",
|
||||
"autwh": "0.1.0",
|
||||
"aws-sdk": "2.1413.0",
|
||||
|
@ -183,7 +182,6 @@
|
|||
"@types/web-push": "3.3.2",
|
||||
"@types/websocket": "1.0.5",
|
||||
"@types/ws": "8.5.5",
|
||||
"autobind-decorator": "2.4.0",
|
||||
"cross-env": "7.0.3",
|
||||
"eslint": "^8.44.0",
|
||||
"execa": "6.1.0",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { defineAsyncComponent, Directive, ref } from "vue";
|
||||
import autobind from "autobind-decorator";
|
||||
import { popup } from "@/os";
|
||||
|
||||
export class UserPreview {
|
||||
|
@ -14,10 +13,17 @@ export class UserPreview {
|
|||
this.el = el;
|
||||
this.user = user;
|
||||
|
||||
this.show = this.show.bind(this);
|
||||
this.close = this.close.bind(this);
|
||||
this.onMouseover = this.onMouseover.bind(this);
|
||||
this.onMouseleave = this.onMouseleave.bind(this);
|
||||
this.onClick = this.onClick.bind(this);
|
||||
this.attach = this.attach.bind(this);
|
||||
this.detach = this.detach.bind(this);
|
||||
|
||||
this.attach();
|
||||
}
|
||||
|
||||
@autobind
|
||||
private show() {
|
||||
if (!document.body.contains(this.el)) return;
|
||||
if (this.promise) return;
|
||||
|
@ -58,7 +64,6 @@ export class UserPreview {
|
|||
}, 1000);
|
||||
}
|
||||
|
||||
@autobind
|
||||
private close() {
|
||||
if (this.promise) {
|
||||
window.clearInterval(this.checkTimer);
|
||||
|
@ -67,34 +72,29 @@ export class UserPreview {
|
|||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
private onMouseover() {
|
||||
window.clearTimeout(this.showTimer);
|
||||
window.clearTimeout(this.hideTimer);
|
||||
this.showTimer = window.setTimeout(this.show, 500);
|
||||
}
|
||||
|
||||
@autobind
|
||||
private onMouseleave() {
|
||||
window.clearTimeout(this.showTimer);
|
||||
window.clearTimeout(this.hideTimer);
|
||||
this.hideTimer = window.setTimeout(this.close, 500);
|
||||
}
|
||||
|
||||
@autobind
|
||||
private onClick() {
|
||||
window.clearTimeout(this.showTimer);
|
||||
this.close();
|
||||
}
|
||||
|
||||
@autobind
|
||||
public attach() {
|
||||
this.el.addEventListener("mouseover", this.onMouseover);
|
||||
this.el.addEventListener("mouseleave", this.onMouseleave);
|
||||
this.el.addEventListener("click", this.onClick);
|
||||
}
|
||||
|
||||
@autobind
|
||||
public detach() {
|
||||
this.el.removeEventListener("mouseover", this.onMouseover);
|
||||
this.el.removeEventListener("mouseleave", this.onMouseleave);
|
||||
|
|
|
@ -132,9 +132,6 @@ importers:
|
|||
argon2:
|
||||
specifier: ^0.30.3
|
||||
version: 0.30.3
|
||||
autobind-decorator:
|
||||
specifier: 2.4.0
|
||||
version: 2.4.0
|
||||
autolinker:
|
||||
specifier: 4.0.0
|
||||
version: 4.0.0
|
||||
|
@ -598,7 +595,7 @@ importers:
|
|||
version: 5.1.6
|
||||
webpack:
|
||||
specifier: ^5.88.1
|
||||
version: 5.88.1(@swc/core@1.3.68)(webpack-cli@5.1.3)
|
||||
version: 5.88.1(@swc/core@1.3.68)
|
||||
ws:
|
||||
specifier: 8.13.0
|
||||
version: 8.13.0
|
||||
|
@ -2988,6 +2985,7 @@ packages:
|
|||
engines: {node: '>=10'}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@swc/wasm': 1.2.130
|
||||
|
||||
|
@ -3094,6 +3092,7 @@ packages:
|
|||
|
||||
/@swc/wasm@1.2.130:
|
||||
resolution: {integrity: sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==}
|
||||
requiresBuild: true
|
||||
|
||||
/@syuilo/aiscript@0.11.1:
|
||||
resolution: {integrity: sha512-chwOIA3yLUKvOB0G611hjLArKTeOWNmTm3lHERSaDW1d+dS6do56naX6Lkwy2UpnwWC0qzeNSgg35elk6t2gZg==}
|
||||
|
@ -5139,7 +5138,7 @@ packages:
|
|||
/axios@0.24.0:
|
||||
resolution: {integrity: sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==}
|
||||
dependencies:
|
||||
follow-redirects: 1.15.2(debug@4.3.4)
|
||||
follow-redirects: 1.15.2
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
@ -5165,7 +5164,7 @@ packages:
|
|||
/axios@1.4.0:
|
||||
resolution: {integrity: sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==}
|
||||
dependencies:
|
||||
follow-redirects: 1.15.2(debug@4.3.4)
|
||||
follow-redirects: 1.15.2
|
||||
form-data: 4.0.0
|
||||
proxy-from-env: 1.1.0
|
||||
transitivePeerDependencies:
|
||||
|
@ -6844,6 +6843,17 @@ packages:
|
|||
dependencies:
|
||||
ms: 2.0.0
|
||||
|
||||
/debug@3.2.7:
|
||||
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
dev: false
|
||||
|
||||
/debug@3.2.7(supports-color@8.1.1):
|
||||
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
|
||||
peerDependencies:
|
||||
|
@ -6854,6 +6864,7 @@ packages:
|
|||
dependencies:
|
||||
ms: 2.1.3
|
||||
supports-color: 8.1.1
|
||||
dev: true
|
||||
|
||||
/debug@4.3.3:
|
||||
resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==}
|
||||
|
@ -8366,6 +8377,16 @@ packages:
|
|||
tabbable: 6.2.0
|
||||
dev: true
|
||||
|
||||
/follow-redirects@1.15.2:
|
||||
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
|
||||
engines: {node: '>=4.0'}
|
||||
peerDependencies:
|
||||
debug: '*'
|
||||
peerDependenciesMeta:
|
||||
debug:
|
||||
optional: true
|
||||
dev: false
|
||||
|
||||
/follow-redirects@1.15.2(debug@4.3.4):
|
||||
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
|
||||
engines: {node: '>=4.0'}
|
||||
|
@ -9334,7 +9355,7 @@ packages:
|
|||
engines: {node: '>= 4.5.0'}
|
||||
dependencies:
|
||||
agent-base: 4.3.0
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
@ -11259,7 +11280,7 @@ packages:
|
|||
json5: 2.2.3
|
||||
loader-utils: 2.0.4
|
||||
schema-utils: 3.3.0
|
||||
webpack: 5.88.1(@swc/core@1.3.68)(webpack-cli@5.1.3)
|
||||
webpack: 5.88.1(@swc/core@1.3.68)
|
||||
dev: true
|
||||
|
||||
/json5@1.0.2:
|
||||
|
@ -11514,7 +11535,7 @@ packages:
|
|||
resolution: {integrity: sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==}
|
||||
engines: {node: '>= 7.6.0'}
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7
|
||||
koa-send: 5.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
@ -12558,7 +12579,7 @@ packages:
|
|||
engines: {node: '>= 4.4.x'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7
|
||||
iconv-lite: 0.4.24
|
||||
sax: 1.2.4
|
||||
transitivePeerDependencies:
|
||||
|
@ -15537,7 +15558,7 @@ packages:
|
|||
webpack: '>=2'
|
||||
dependencies:
|
||||
'@swc/core': 1.3.68
|
||||
webpack: 5.88.1(@swc/core@1.3.68)(webpack-cli@5.1.3)
|
||||
webpack: 5.88.1(@swc/core@1.3.68)
|
||||
dev: true
|
||||
|
||||
/swiper@10.0.4:
|
||||
|
@ -15656,7 +15677,7 @@ packages:
|
|||
schema-utils: 3.3.0
|
||||
serialize-javascript: 6.0.1
|
||||
terser: 5.19.0
|
||||
webpack: 5.88.1(@swc/core@1.3.68)(webpack-cli@5.1.3)
|
||||
webpack: 5.88.1(@swc/core@1.3.68)
|
||||
dev: true
|
||||
|
||||
/terser@5.19.0:
|
||||
|
@ -15995,7 +16016,7 @@ packages:
|
|||
micromatch: 4.0.5
|
||||
semver: 7.5.4
|
||||
typescript: 5.1.6
|
||||
webpack: 5.88.1(@swc/core@1.3.68)(webpack-cli@5.1.3)
|
||||
webpack: 5.88.1(@swc/core@1.3.68)
|
||||
dev: true
|
||||
|
||||
/ts-node@10.4.0(@swc/core@1.3.68)(@types/node@20.3.1)(typescript@5.1.3):
|
||||
|
@ -16912,6 +16933,46 @@ packages:
|
|||
engines: {node: '>=10.13.0'}
|
||||
dev: true
|
||||
|
||||
/webpack@5.88.1(@swc/core@1.3.68):
|
||||
resolution: {integrity: sha512-FROX3TxQnC/ox4N+3xQoWZzvGXSuscxR32rbzjpXgEzWudJFEJBpdlkkob2ylrv5yzzufD1zph1OoFsLtm6stQ==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
webpack-cli: '*'
|
||||
peerDependenciesMeta:
|
||||
webpack-cli:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/eslint-scope': 3.7.4
|
||||
'@types/estree': 1.0.1
|
||||
'@webassemblyjs/ast': 1.11.6
|
||||
'@webassemblyjs/wasm-edit': 1.11.6
|
||||
'@webassemblyjs/wasm-parser': 1.11.6
|
||||
acorn: 8.10.0
|
||||
acorn-import-assertions: 1.9.0(acorn@8.10.0)
|
||||
browserslist: 4.21.9
|
||||
chrome-trace-event: 1.0.3
|
||||
enhanced-resolve: 5.15.0
|
||||
es-module-lexer: 1.3.0
|
||||
eslint-scope: 5.1.1
|
||||
events: 3.3.0
|
||||
glob-to-regexp: 0.4.1
|
||||
graceful-fs: 4.2.11
|
||||
json-parse-even-better-errors: 2.3.1
|
||||
loader-runner: 4.3.0
|
||||
mime-types: 2.1.35
|
||||
neo-async: 2.6.2
|
||||
schema-utils: 3.3.0
|
||||
tapable: 2.2.1
|
||||
terser-webpack-plugin: 5.3.9(@swc/core@1.3.68)(webpack@5.88.1)
|
||||
watchpack: 2.4.0
|
||||
webpack-sources: 3.2.3
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- esbuild
|
||||
- uglify-js
|
||||
dev: true
|
||||
|
||||
/webpack@5.88.1(@swc/core@1.3.68)(webpack-cli@5.1.3):
|
||||
resolution: {integrity: sha512-FROX3TxQnC/ox4N+3xQoWZzvGXSuscxR32rbzjpXgEzWudJFEJBpdlkkob2ylrv5yzzufD1zph1OoFsLtm6stQ==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
|
Loading…
Reference in a new issue