Tracking de l'application VApp (IHM du jeu)

This commit is contained in:
2025-05-11 18:04:12 +02:00
commit 89e9db9b62
17763 changed files with 3718499 additions and 0 deletions

21
VApp/node_modules/worker-timers-worker/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Christoph Guttandin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

5
VApp/node_modules/worker-timers-worker/README.md generated vendored Normal file
View File

@ -0,0 +1,5 @@
# worker-timers-worker
**The worker which is used by the worker-timers package.**
[![version](https://img.shields.io/npm/v/worker-timers-worker.svg?style=flat-square)](https://www.npmjs.com/package/worker-timers-worker)

View File

@ -0,0 +1,5 @@
export declare const clearScheduledInterval: (timerId: number) => void;
export declare const clearScheduledTimeout: (timerId: number) => void;
export declare const scheduleInterval: (delay: number, timerId: number, nowInMainThread: number) => void;
export declare const scheduleTimeout: (delay: number, timerId: number, nowInMainThread: number) => void;
//# sourceMappingURL=timer.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../../src/helpers/timer.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,YAAa,MAAM,SASrD,CAAC;AAEF,eAAO,MAAM,qBAAqB,YAAa,MAAM,SASpD,CAAC;AA0BF,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAAW,MAAM,mBAAmB,MAAM,SAOvF,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,MAAM,WAAW,MAAM,mBAAmB,MAAM,SAOtF,CAAC"}

View File

@ -0,0 +1,50 @@
const scheduledIntervalIdentifiers = new Map();
const scheduledTimeoutIdentifiers = new Map();
export const clearScheduledInterval = (timerId) => {
const identifier = scheduledIntervalIdentifiers.get(timerId);
if (identifier !== undefined) {
clearTimeout(identifier);
scheduledIntervalIdentifiers.delete(timerId);
}
else {
throw new Error(`There is no interval scheduled with the given id "${timerId}".`);
}
};
export const clearScheduledTimeout = (timerId) => {
const identifier = scheduledTimeoutIdentifiers.get(timerId);
if (identifier !== undefined) {
clearTimeout(identifier);
scheduledTimeoutIdentifiers.delete(timerId);
}
else {
throw new Error(`There is no timeout scheduled with the given id "${timerId}".`);
}
};
const computeDelayAndExpectedCallbackTime = (delay, nowInMainThread) => {
let now;
let remainingDelay;
const nowInWorker = performance.now();
const elapsed = Math.max(0, nowInWorker - nowInMainThread);
now = nowInWorker;
remainingDelay = delay - elapsed;
const expected = now + remainingDelay;
return { expected, remainingDelay };
};
const setTimeoutCallback = (identifiers, timerId, expected, timerType) => {
const now = performance.now();
if (now > expected) {
postMessage({ id: null, method: 'call', params: { timerId, timerType } });
}
else {
identifiers.set(timerId, setTimeout(setTimeoutCallback, expected - now, identifiers, timerId, expected, timerType));
}
};
export const scheduleInterval = (delay, timerId, nowInMainThread) => {
const { expected, remainingDelay } = computeDelayAndExpectedCallbackTime(delay, nowInMainThread);
scheduledIntervalIdentifiers.set(timerId, setTimeout(setTimeoutCallback, remainingDelay, scheduledIntervalIdentifiers, timerId, expected, 'interval'));
};
export const scheduleTimeout = (delay, timerId, nowInMainThread) => {
const { expected, remainingDelay } = computeDelayAndExpectedCallbackTime(delay, nowInMainThread);
scheduledTimeoutIdentifiers.set(timerId, setTimeout(setTimeoutCallback, remainingDelay, scheduledTimeoutIdentifiers, timerId, expected, 'timeout'));
};
//# sourceMappingURL=timer.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../../../src/helpers/timer.ts"],"names":[],"mappings":"AAEA,MAAM,4BAA4B,GAAwB,IAAI,GAAG,EAAE,CAAC;AACpE,MAAM,2BAA2B,GAAwB,IAAI,GAAG,EAAE,CAAC;AAEnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAE,EAAE;IACtD,MAAM,UAAU,GAAG,4BAA4B,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE7D,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,YAAY,CAAC,UAAU,CAAC,CAAC;QACzB,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,qDAAqD,OAAO,IAAI,CAAC,CAAC;IACtF,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAE,EAAE;IACrD,MAAM,UAAU,GAAG,2BAA2B,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE5D,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,YAAY,CAAC,UAAU,CAAC,CAAC;QACzB,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,oDAAoD,OAAO,IAAI,CAAC,CAAC;IACrF,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,mCAAmC,GAAG,CAAC,KAAa,EAAE,eAAuB,EAAE,EAAE;IACnF,IAAI,GAAW,CAAC;IAChB,IAAI,cAAsB,CAAC;IAC3B,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,eAAe,CAAC,CAAC;IAE3D,GAAG,GAAG,WAAW,CAAC;IAClB,cAAc,GAAG,KAAK,GAAG,OAAO,CAAC;IAEjC,MAAM,QAAQ,GAAG,GAAG,GAAG,cAAc,CAAC;IAEtC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,WAAgC,EAAE,OAAe,EAAE,QAAgB,EAAE,SAAiB,EAAE,EAAE;IAClH,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAE9B,IAAI,GAAG,GAAG,QAAQ,EAAE,CAAC;QACjB,WAAW,CAAoB,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IACjG,CAAC;SAAM,CAAC;QACJ,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,kBAAkB,EAAE,QAAQ,GAAG,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IACxH,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,OAAe,EAAE,eAAuB,EAAE,EAAE;IACxF,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,mCAAmC,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAEjG,4BAA4B,CAAC,GAAG,CAC5B,OAAO,EACP,UAAU,CAAC,kBAAkB,EAAE,cAAc,EAAE,4BAA4B,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAC9G,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,OAAe,EAAE,eAAuB,EAAE,EAAE;IACvF,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,mCAAmC,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAEjG,2BAA2B,CAAC,GAAG,CAC3B,OAAO,EACP,UAAU,CAAC,kBAAkB,EAAE,cAAc,EAAE,2BAA2B,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAC5G,CAAC;AACN,CAAC,CAAC"}

View File

@ -0,0 +1,5 @@
import { TBrokerMessage } from '../types';
export interface IBrokerEvent extends Event {
data: TBrokerMessage;
}
//# sourceMappingURL=broker-event.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"broker-event.d.ts","sourceRoot":"","sources":["../../../src/interfaces/broker-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,WAAW,YAAa,SAAQ,KAAK;IACvC,IAAI,EAAE,cAAc,CAAC;CACxB"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=broker-event.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"broker-event.js","sourceRoot":"","sources":["../../../src/interfaces/broker-event.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,10 @@
import { TTimerType } from '../types';
export interface ICallNotification {
id: null;
method: 'call';
params: {
timerId: number;
timerType: TTimerType;
};
}
//# sourceMappingURL=call-notification.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"call-notification.d.ts","sourceRoot":"","sources":["../../../src/interfaces/call-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,IAAI,CAAC;IAET,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAEhB,SAAS,EAAE,UAAU,CAAC;KACzB,CAAC;CACL"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=call-notification.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"call-notification.js","sourceRoot":"","sources":["../../../src/interfaces/call-notification.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,10 @@
import { TTimerType } from '../types';
export interface IClearRequest {
id: number;
method: 'clear';
params: {
timerId: number;
timerType: TTimerType;
};
}
//# sourceMappingURL=clear-request.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"clear-request.d.ts","sourceRoot":"","sources":["../../../src/interfaces/clear-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IAEX,MAAM,EAAE,OAAO,CAAC;IAEhB,MAAM,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAEhB,SAAS,EAAE,UAAU,CAAC;KACzB,CAAC;CACL"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=clear-request.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"clear-request.js","sourceRoot":"","sources":["../../../src/interfaces/clear-request.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,5 @@
export interface IClearResponse {
error: null;
id: number;
}
//# sourceMappingURL=clear-response.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"clear-response.d.ts","sourceRoot":"","sources":["../../../src/interfaces/clear-response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,IAAI,CAAC;IAEZ,EAAE,EAAE,MAAM,CAAC;CACd"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=clear-response.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"clear-response.js","sourceRoot":"","sources":["../../../src/interfaces/clear-response.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,8 @@
export interface IErrorNotification {
error: {
message: string;
};
id: null;
result: null;
}
//# sourceMappingURL=error-notification.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"error-notification.d.ts","sourceRoot":"","sources":["../../../src/interfaces/error-notification.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;IAEF,EAAE,EAAE,IAAI,CAAC;IAET,MAAM,EAAE,IAAI,CAAC;CAChB"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=error-notification.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"error-notification.js","sourceRoot":"","sources":["../../../src/interfaces/error-notification.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,8 @@
export interface IErrorResponse {
error: {
message: string;
};
id: number;
result: null;
}
//# sourceMappingURL=error-response.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"error-response.d.ts","sourceRoot":"","sources":["../../../src/interfaces/error-response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;IAEF,EAAE,EAAE,MAAM,CAAC;IAEX,MAAM,EAAE,IAAI,CAAC;CAChB"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=error-response.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"error-response.js","sourceRoot":"","sources":["../../../src/interfaces/error-response.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,9 @@
export * from './broker-event';
export * from './call-notification';
export * from './clear-request';
export * from './clear-response';
export * from './error-notification';
export * from './error-response';
export * from './set-notification';
export * from './worker-event';
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}

View File

@ -0,0 +1,9 @@
export * from './broker-event';
export * from './call-notification';
export * from './clear-request';
export * from './clear-response';
export * from './error-notification';
export * from './error-response';
export * from './set-notification';
export * from './worker-event';
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}

View File

@ -0,0 +1,12 @@
import { TTimerType } from '../types';
export interface ISetNotification {
id: null;
method: 'set';
params: {
delay: number;
now: number;
timerId: number;
timerType: TTimerType;
};
}
//# sourceMappingURL=set-notification.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"set-notification.d.ts","sourceRoot":"","sources":["../../../src/interfaces/set-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,IAAI,CAAC;IAET,MAAM,EAAE,KAAK,CAAC;IAEd,MAAM,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QAEd,GAAG,EAAE,MAAM,CAAC;QAEZ,OAAO,EAAE,MAAM,CAAC;QAEhB,SAAS,EAAE,UAAU,CAAC;KACzB,CAAC;CACL"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=set-notification.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"set-notification.js","sourceRoot":"","sources":["../../../src/interfaces/set-notification.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,5 @@
import { TWorkerMessage } from '../types';
export interface IWorkerEvent extends Event {
data: TWorkerMessage;
}
//# sourceMappingURL=worker-event.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"worker-event.d.ts","sourceRoot":"","sources":["../../../src/interfaces/worker-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,WAAW,YAAa,SAAQ,KAAK;IACvC,IAAI,EAAE,cAAc,CAAC;CACxB"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=worker-event.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"worker-event.js","sourceRoot":"","sources":["../../../src/interfaces/worker-event.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,3 @@
export * from './interfaces/index';
export * from './types/index';
//# sourceMappingURL=module.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAOA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}

View File

@ -0,0 +1,50 @@
import { clearScheduledInterval, clearScheduledTimeout, scheduleInterval, scheduleTimeout } from './helpers/timer';
/*
* @todo Explicitly referencing the barrel file seems to be necessary when enabling the
* isolatedModules compiler option.
*/
export * from './interfaces/index';
export * from './types/index';
addEventListener('message', ({ data }) => {
try {
if (data.method === 'clear') {
const { id, params: { timerId, timerType } } = data;
if (timerType === 'interval') {
clearScheduledInterval(timerId);
postMessage({ error: null, id });
}
else if (timerType === 'timeout') {
clearScheduledTimeout(timerId);
postMessage({ error: null, id });
}
else {
throw new Error(`The given type "${timerType}" is not supported`);
}
}
else if (data.method === 'set') {
const { params: { delay, now, timerId, timerType } } = data;
if (timerType === 'interval') {
scheduleInterval(delay, timerId, now);
}
else if (timerType === 'timeout') {
scheduleTimeout(delay, timerId, now);
}
else {
throw new Error(`The given type "${timerType}" is not supported`);
}
}
else {
throw new Error(`The given method "${data.method}" is not supported`);
}
}
catch (err) {
postMessage({
error: {
message: err.message
},
id: data.id,
result: null
});
}
});
//# sourceMappingURL=module.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGnH;;;GAGG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAE9B,gBAAgB,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAgB,EAAE,EAAE;IACnD,IAAI,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC1B,MAAM,EACF,EAAE,EACF,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EACjC,GAAG,IAAI,CAAC;YAET,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;gBAC3B,sBAAsB,CAAC,OAAO,CAAC,CAAC;gBAEhC,WAAW,CAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACrD,CAAC;iBAAM,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;gBACjC,qBAAqB,CAAC,OAAO,CAAC,CAAC;gBAE/B,WAAW,CAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,oBAAoB,CAAC,CAAC;YACtE,CAAC;QACL,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC/B,MAAM,EACF,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,EAC7C,GAAG,IAAI,CAAC;YAET,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;gBAC3B,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;YAC1C,CAAC;iBAAM,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;gBACjC,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,oBAAoB,CAAC,CAAC;YACtE,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,KAAK,CAAC,qBAA2B,IAAK,CAAC,MAAM,oBAAoB,CAAC,CAAC;QACjF,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,WAAW,CAAsC;YAC7C,KAAK,EAAE;gBACH,OAAO,EAAE,GAAG,CAAC,OAAO;aACvB;YACD,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,MAAM,EAAE,IAAI;SACf,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@ -0,0 +1,3 @@
import { IClearRequest, ISetNotification } from '../interfaces';
export type TBrokerMessage = IClearRequest | ISetNotification;
//# sourceMappingURL=broker-message.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"broker-message.d.ts","sourceRoot":"","sources":["../../../src/types/broker-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,gBAAgB,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=broker-message.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"broker-message.js","sourceRoot":"","sources":["../../../src/types/broker-message.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,4 @@
export * from './broker-message';
export * from './timer-type';
export * from './worker-message';
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}

View File

@ -0,0 +1,4 @@
export * from './broker-message';
export * from './timer-type';
export * from './worker-message';
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}

View File

@ -0,0 +1,2 @@
export type TTimerType = 'interval' | 'timeout';
//# sourceMappingURL=timer-type.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"timer-type.d.ts","sourceRoot":"","sources":["../../../src/types/timer-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=timer-type.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"timer-type.js","sourceRoot":"","sources":["../../../src/types/timer-type.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,3 @@
import { ICallNotification, IClearResponse, IErrorNotification, IErrorResponse } from '../interfaces';
export type TWorkerMessage = ICallNotification | IClearResponse | IErrorNotification | IErrorResponse;
//# sourceMappingURL=worker-message.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"worker-message.d.ts","sourceRoot":"","sources":["../../../src/types/worker-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtG,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,cAAc,GAAG,kBAAkB,GAAG,cAAc,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=worker-message.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"worker-message.js","sourceRoot":"","sources":["../../../src/types/worker-message.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,117 @@
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
})((function () { 'use strict';
var scheduledIntervalIdentifiers = new Map();
var scheduledTimeoutIdentifiers = new Map();
var clearScheduledInterval = function clearScheduledInterval(timerId) {
var identifier = scheduledIntervalIdentifiers.get(timerId);
if (identifier !== undefined) {
clearTimeout(identifier);
scheduledIntervalIdentifiers["delete"](timerId);
} else {
throw new Error("There is no interval scheduled with the given id \"".concat(timerId, "\"."));
}
};
var clearScheduledTimeout = function clearScheduledTimeout(timerId) {
var identifier = scheduledTimeoutIdentifiers.get(timerId);
if (identifier !== undefined) {
clearTimeout(identifier);
scheduledTimeoutIdentifiers["delete"](timerId);
} else {
throw new Error("There is no timeout scheduled with the given id \"".concat(timerId, "\"."));
}
};
var computeDelayAndExpectedCallbackTime = function computeDelayAndExpectedCallbackTime(delay, nowInMainThread) {
var now;
var remainingDelay;
var nowInWorker = performance.now();
var elapsed = Math.max(0, nowInWorker - nowInMainThread);
now = nowInWorker;
remainingDelay = delay - elapsed;
var expected = now + remainingDelay;
return {
expected: expected,
remainingDelay: remainingDelay
};
};
var setTimeoutCallback = function setTimeoutCallback(identifiers, timerId, expected, timerType) {
var now = performance.now();
if (now > expected) {
postMessage({
id: null,
method: 'call',
params: {
timerId: timerId,
timerType: timerType
}
});
} else {
identifiers.set(timerId, setTimeout(setTimeoutCallback, expected - now, identifiers, timerId, expected, timerType));
}
};
var scheduleInterval = function scheduleInterval(delay, timerId, nowInMainThread) {
var _computeDelayAndExpec = computeDelayAndExpectedCallbackTime(delay, nowInMainThread),
expected = _computeDelayAndExpec.expected,
remainingDelay = _computeDelayAndExpec.remainingDelay;
scheduledIntervalIdentifiers.set(timerId, setTimeout(setTimeoutCallback, remainingDelay, scheduledIntervalIdentifiers, timerId, expected, 'interval'));
};
var scheduleTimeout = function scheduleTimeout(delay, timerId, nowInMainThread) {
var _computeDelayAndExpec2 = computeDelayAndExpectedCallbackTime(delay, nowInMainThread),
expected = _computeDelayAndExpec2.expected,
remainingDelay = _computeDelayAndExpec2.remainingDelay;
scheduledTimeoutIdentifiers.set(timerId, setTimeout(setTimeoutCallback, remainingDelay, scheduledTimeoutIdentifiers, timerId, expected, 'timeout'));
};
addEventListener('message', function (_ref) {
var data = _ref.data;
try {
if (data.method === 'clear') {
var id = data.id,
_data$params = data.params,
timerId = _data$params.timerId,
timerType = _data$params.timerType;
if (timerType === 'interval') {
clearScheduledInterval(timerId);
postMessage({
error: null,
id: id
});
} else if (timerType === 'timeout') {
clearScheduledTimeout(timerId);
postMessage({
error: null,
id: id
});
} else {
throw new Error("The given type \"".concat(timerType, "\" is not supported"));
}
} else if (data.method === 'set') {
var _data$params2 = data.params,
delay = _data$params2.delay,
now = _data$params2.now,
_timerId = _data$params2.timerId,
_timerType = _data$params2.timerType;
if (_timerType === 'interval') {
scheduleInterval(delay, _timerId, now);
} else if (_timerType === 'timeout') {
scheduleTimeout(delay, _timerId, now);
} else {
throw new Error("The given type \"".concat(_timerType, "\" is not supported"));
}
} else {
throw new Error("The given method \"".concat(data.method, "\" is not supported"));
}
} catch (err) {
postMessage({
error: {
message: err.message
},
id: data.id,
result: null
});
}
});
}));

91
VApp/node_modules/worker-timers-worker/package.json generated vendored Normal file
View File

@ -0,0 +1,91 @@
{
"author": "Christoph Guttandin",
"bugs": {
"url": "https://github.com/chrisguttandin/worker-timers-worker/issues"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"contributors": [
{
"email": "vac872089248@gmail.com",
"name": "Knissing"
}
],
"dependencies": {
"@babel/runtime": "^7.23.9",
"tslib": "^2.6.2"
},
"description": "The worker which is used by the worker-timers package.",
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/plugin-external-helpers": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@commitlint/cli": "^18.6.0",
"@commitlint/config-angular": "^18.6.0",
"@rollup/plugin-babel": "^6.0.4",
"chai": "^4.3.10",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.56.0",
"eslint-config-holy-grail": "^58.0.2",
"grunt": "^1.6.1",
"grunt-cli": "^1.4.3",
"grunt-sh": "^0.2.1",
"husky": "^8.0.3",
"karma": "^6.4.2",
"karma-browserstack-launcher": "^1.6.0",
"karma-chrome-launcher": "^3.2.0",
"karma-cli": "^2.0.0",
"karma-firefox-launcher": "^2.1.2",
"karma-mocha": "^2.0.1",
"karma-mocha-webworker": "^1.3.0",
"karma-sinon-chai": "^2.0.2",
"karma-webkit-launcher": "^2.4.0",
"karma-webpack": "^5.0.1",
"lint-staged": "^15.2.2",
"load-grunt-config": "^4.0.1",
"memory-fs": "^0.5.0",
"mocha": "^10.2.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"rollup": "^4.9.6",
"sinon": "^17.0.1",
"sinon-chai": "^3.7.0",
"ts-loader": "^9.5.1",
"tsconfig-holy-grail": "^15.0.0",
"tslint": "^6.1.3",
"tslint-config-holy-grail": "^56.0.0",
"typescript": "^5.3.3",
"webpack": "^5.90.1"
},
"files": [
"build/es2019/",
"build/es5/",
"src/"
],
"homepage": "https://github.com/chrisguttandin/worker-timers-worker",
"license": "MIT",
"main": "build/es5/bundle.js",
"module": "build/es2019/module.js",
"name": "worker-timers-worker",
"repository": {
"type": "git",
"url": "https://github.com/chrisguttandin/worker-timers-worker.git"
},
"scripts": {
"build": "rimraf build/* && tsc --project src/tsconfig.json && rollup --config config/rollup/bundle.mjs",
"lint": "npm run lint:config && npm run lint:src && npm run lint:test",
"lint:config": "eslint --config config/eslint/config.json --ext .js --report-unused-disable-directives config/",
"lint:src": "tslint --config config/tslint/src.json --project src/tsconfig.json src/*.ts src/**/*.ts",
"lint:test": "eslint --config config/eslint/test.json --ext .js --report-unused-disable-directives test/",
"prepare": "husky install",
"prepublishOnly": "npm run build",
"test": "grunt lint && grunt test"
},
"types": "build/es2019/module.d.ts",
"version": "7.0.66"
}

View File

@ -0,0 +1,68 @@
import { ICallNotification } from '../interfaces';
const scheduledIntervalIdentifiers: Map<number, number> = new Map();
const scheduledTimeoutIdentifiers: Map<number, number> = new Map();
export const clearScheduledInterval = (timerId: number) => {
const identifier = scheduledIntervalIdentifiers.get(timerId);
if (identifier !== undefined) {
clearTimeout(identifier);
scheduledIntervalIdentifiers.delete(timerId);
} else {
throw new Error(`There is no interval scheduled with the given id "${timerId}".`);
}
};
export const clearScheduledTimeout = (timerId: number) => {
const identifier = scheduledTimeoutIdentifiers.get(timerId);
if (identifier !== undefined) {
clearTimeout(identifier);
scheduledTimeoutIdentifiers.delete(timerId);
} else {
throw new Error(`There is no timeout scheduled with the given id "${timerId}".`);
}
};
const computeDelayAndExpectedCallbackTime = (delay: number, nowInMainThread: number) => {
let now: number;
let remainingDelay: number;
const nowInWorker = performance.now();
const elapsed = Math.max(0, nowInWorker - nowInMainThread);
now = nowInWorker;
remainingDelay = delay - elapsed;
const expected = now + remainingDelay;
return { expected, remainingDelay };
};
const setTimeoutCallback = (identifiers: Map<number, number>, timerId: number, expected: number, timerType: string) => {
const now = performance.now();
if (now > expected) {
postMessage(<ICallNotification>{ id: null, method: 'call', params: { timerId, timerType } });
} else {
identifiers.set(timerId, setTimeout(setTimeoutCallback, expected - now, identifiers, timerId, expected, timerType));
}
};
export const scheduleInterval = (delay: number, timerId: number, nowInMainThread: number) => {
const { expected, remainingDelay } = computeDelayAndExpectedCallbackTime(delay, nowInMainThread);
scheduledIntervalIdentifiers.set(
timerId,
setTimeout(setTimeoutCallback, remainingDelay, scheduledIntervalIdentifiers, timerId, expected, 'interval')
);
};
export const scheduleTimeout = (delay: number, timerId: number, nowInMainThread: number) => {
const { expected, remainingDelay } = computeDelayAndExpectedCallbackTime(delay, nowInMainThread);
scheduledTimeoutIdentifiers.set(
timerId,
setTimeout(setTimeoutCallback, remainingDelay, scheduledTimeoutIdentifiers, timerId, expected, 'timeout')
);
};

View File

@ -0,0 +1,5 @@
import { TBrokerMessage } from '../types';
export interface IBrokerEvent extends Event {
data: TBrokerMessage;
}

View File

@ -0,0 +1,13 @@
import { TTimerType } from '../types';
export interface ICallNotification {
id: null;
method: 'call';
params: {
timerId: number;
timerType: TTimerType;
};
}

View File

@ -0,0 +1,13 @@
import { TTimerType } from '../types';
export interface IClearRequest {
id: number;
method: 'clear';
params: {
timerId: number;
timerType: TTimerType;
};
}

View File

@ -0,0 +1,5 @@
export interface IClearResponse {
error: null;
id: number;
}

View File

@ -0,0 +1,9 @@
export interface IErrorNotification {
error: {
message: string;
};
id: null;
result: null;
}

View File

@ -0,0 +1,9 @@
export interface IErrorResponse {
error: {
message: string;
};
id: number;
result: null;
}

View File

@ -0,0 +1,8 @@
export * from './broker-event';
export * from './call-notification';
export * from './clear-request';
export * from './clear-response';
export * from './error-notification';
export * from './error-response';
export * from './set-notification';
export * from './worker-event';

View File

@ -0,0 +1,17 @@
import { TTimerType } from '../types';
export interface ISetNotification {
id: null;
method: 'set';
params: {
delay: number;
now: number;
timerId: number;
timerType: TTimerType;
};
}

View File

@ -0,0 +1,5 @@
import { TWorkerMessage } from '../types';
export interface IWorkerEvent extends Event {
data: TWorkerMessage;
}

54
VApp/node_modules/worker-timers-worker/src/module.ts generated vendored Normal file
View File

@ -0,0 +1,54 @@
import { clearScheduledInterval, clearScheduledTimeout, scheduleInterval, scheduleTimeout } from './helpers/timer';
import { IBrokerEvent, IClearResponse, IErrorNotification, IErrorResponse } from './interfaces';
/*
* @todo Explicitly referencing the barrel file seems to be necessary when enabling the
* isolatedModules compiler option.
*/
export * from './interfaces/index';
export * from './types/index';
addEventListener('message', ({ data }: IBrokerEvent) => {
try {
if (data.method === 'clear') {
const {
id,
params: { timerId, timerType }
} = data;
if (timerType === 'interval') {
clearScheduledInterval(timerId);
postMessage(<IClearResponse>{ error: null, id });
} else if (timerType === 'timeout') {
clearScheduledTimeout(timerId);
postMessage(<IClearResponse>{ error: null, id });
} else {
throw new Error(`The given type "${timerType}" is not supported`);
}
} else if (data.method === 'set') {
const {
params: { delay, now, timerId, timerType }
} = data;
if (timerType === 'interval') {
scheduleInterval(delay, timerId, now);
} else if (timerType === 'timeout') {
scheduleTimeout(delay, timerId, now);
} else {
throw new Error(`The given type "${timerType}" is not supported`);
}
} else {
throw new Error(`The given method "${(<any>data).method}" is not supported`);
}
} catch (err) {
postMessage(<IErrorNotification | IErrorResponse>{
error: {
message: err.message
},
id: data.id,
result: null
});
}
});

View File

@ -0,0 +1,6 @@
{
"compilerOptions": {
"isolatedModules": true
},
"extends": "tsconfig-holy-grail/src/tsconfig-web-worker"
}

View File

@ -0,0 +1,3 @@
import { IClearRequest, ISetNotification } from '../interfaces';
export type TBrokerMessage = IClearRequest | ISetNotification;

View File

@ -0,0 +1,3 @@
export * from './broker-message';
export * from './timer-type';
export * from './worker-message';

View File

@ -0,0 +1 @@
export type TTimerType = 'interval' | 'timeout';

View File

@ -0,0 +1,3 @@
import { ICallNotification, IClearResponse, IErrorNotification, IErrorResponse } from '../interfaces';
export type TWorkerMessage = ICallNotification | IClearResponse | IErrorNotification | IErrorResponse;