PageSourceSearch

https://simg.wooribank.com/js/nbi/lib/extra/shw-timer.js?20221227

js wooribank.com collected 2026-10-01 10:39:47 UTC 1,603 bytes, 82 lines download raw bytes

1/**
2 * Countdown Timer for Shared Worker
3 */
4
5const allPorts = [];
6
7// Shared Web Worker
8self.onconnect = (e) => {
9	var port = e.ports[0];
10	
11	allPorts.push(port);
12	
13	port.addEventListener('message', function(ev) {
14		const cmd = ev.data.cmd;
15		switch (cmd) {
16			case 'start':
17				timer.stop().clear().set(ev.data.duration).run();
18				break;
19			case 'stop':
20				self.close();
21				break;
22			case 'reset':
23				timer.stop().set(ev.data.duration)
24				.run();
25				break;
26		}
27	});
28	
29	port.start();
30};
31
32var timer = {
33	tid: undefined,
34	duration: 0,
35	isStop: true,
36	expired: undefined,
37	set(sec) {
38		if (sec < 0) { sec = 0; }
39		this.duration = sec || 570;
40		return this;
41	},
42	run() {
43		if (typeof this.tid === 'undefined') {
44			this.isStop = false;
45			this.expired = false;
46			this.tid = setTimeout (
47				function _run(remains){
48					if(!timer.isStop){
49						timer.tid = setTimeout(_run, 1000, --remains);
50						if (remains < 0 ) {
51							timer.expired = true;
52							timer.stop();
53						} else {
54							var rst = timer.parse(remains);
55							allPorts.forEach((port) => {
56								port.postMessage({status: 'running', time: rst});
57							});
58						}
59					}
60			}, 1000, this.duration );
61		} else {
62			allPorts.forEach((port) => {
63				port.postMessage({status: 'expired', time: this.parse(0)});
64			});
65		}
66	},
67	stop() {
68		if (!!this.tid) {
69			clearTimeout(this.tid);
70		}
71		this.tid = this.expired ? null : undefined;
72		this.isStop = true;
73		return this;
74	},
75	parse: (remains) => {
76		return {min: parseInt(remains / 60, 10), sec: parseInt(remains % 60, 10)};
77	},
78	clear() {
79		this.tid = undefined;
80		return this;
81	}
82}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.