更新
This commit is contained in:
parent
8c092a622a
commit
870686032d
File diff suppressed because one or more lines are too long
@ -132,6 +132,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
zhongNode.querySelectorAll('#wh-trans-fest-date button').forEach((el, i) => i === 0
|
||||
? el.addEventListener('click', () => {
|
||||
let html = '<table>';
|
||||
// TODO 动态节日数据
|
||||
settings.fest_date_list.sort().forEach(date =>
|
||||
html += `<tr><td>${ 1 + ((<any>date.slice(0, 2)) | 0) }月${ date.slice(2) }日</td><td>${ settings.fest_date_dict[date].name }</td><td>${ settings.fest_date_dict[date].eff }</td></tr>`
|
||||
);
|
||||
@ -142,6 +143,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
zhongNode.querySelectorAll('#wh-trans-event-cont button').forEach((el, i) => i === 0
|
||||
? el.addEventListener('click', () => {
|
||||
let html = '<table>';
|
||||
// TODO 动态节日数据
|
||||
settings.events.forEach(el =>
|
||||
html += `<tr><td><b>${ el.name }</b></td><td>${ el.start[0] + 1 }月${ el.start[1] }日${ el.start[2] }:00~${ el.end[0] + 1 }月${ el.end[1] }日${ el.end[2] }:00</td></tr><tr><td colspan="2">${ el.eff }</td></tr>`);
|
||||
new Popup(html += '</table><p>更多信息请关注群聊和公众号</p>', '活动');
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import Log from "../Log";
|
||||
import Timer from "../utils/Timer";
|
||||
|
||||
/**
|
||||
* 基类、单例
|
||||
@ -9,16 +10,16 @@ export default class Provider {
|
||||
|
||||
private static readonly pool = {};
|
||||
|
||||
constructor() {
|
||||
constructor(...args: unknown[]) {
|
||||
}
|
||||
|
||||
// 返回继承类的实例
|
||||
public static getInstance<T extends typeof Provider>(this: T): InstanceType<T> {
|
||||
public static getInstance<T extends typeof Provider>(this: T, ...args: unknown[]): InstanceType<T> {
|
||||
if (!this.instance) {
|
||||
let startTime = performance.now();
|
||||
this.instance = new this();
|
||||
let startTime = new Timer();
|
||||
this.instance = new this(...args);
|
||||
let thatName = this.instance.getClassName() || this.name;
|
||||
Log.info('实例已创建,', thatName, this.instance, '耗时' + ((performance.now() - startTime) | 0) + 'ms');
|
||||
Log.info('实例已创建,', thatName, this.instance, '耗时' + startTime.getTimeMs());
|
||||
Provider.pool[thatName] = this.instance;
|
||||
}
|
||||
return this.instance;
|
||||
|
||||
@ -7,8 +7,9 @@ export default class Timer {
|
||||
|
||||
/**
|
||||
* 返回计时毫秒数以ms结束
|
||||
* `'99ms'`
|
||||
*/
|
||||
public getTimeMs(): string {
|
||||
return ((performance.now() - this.startTime) | 0) + 'ms';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user