onmessage = function()

in src/com.jetbrains.youtrack.sdPlugin/libs/js/timers.js [80:94]


	onmessage = function (e) {
		// first see, if we have a timer with this id and remove it
		// this automatically fulfils clearTimeout and clearInterval
		supportedCommands.includes(e.data.type) && timers[e.data.id] && clearTimerAndRemove(e.data.id);
		if (e.data.type === 'setTimeout') {
			timers[e.data.id] = setTimeout(() => {
				postMessage({id: e.data.id});
				clearTimerAndRemove(e.data.id); //cleaning up
			}, Math.max(e.data.delay || 0));
		} else if (e.data.type === 'setInterval') {
			timers[e.data.id] = setInterval(() => {
				postMessage({id: e.data.id});
			}, Math.max(e.data.delay || ESDDefaultTimeouts.interval));
		}
	};