Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
214
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/WebSocketSubject.js
generated
vendored
Normal file
214
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/WebSocketSubject.js
generated
vendored
Normal file
@ -0,0 +1,214 @@
|
||||
import { Subject, AnonymousSubject } from '../../Subject';
|
||||
import { Subscriber } from '../../Subscriber';
|
||||
import { Observable } from '../../Observable';
|
||||
import { Subscription } from '../../Subscription';
|
||||
import { ReplaySubject } from '../../ReplaySubject';
|
||||
const DEFAULT_WEBSOCKET_CONFIG = {
|
||||
url: '',
|
||||
deserializer: (e) => JSON.parse(e.data),
|
||||
serializer: (value) => JSON.stringify(value),
|
||||
};
|
||||
const WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT = 'WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }';
|
||||
export class WebSocketSubject extends AnonymousSubject {
|
||||
constructor(urlConfigOrSource, destination) {
|
||||
super();
|
||||
this._socket = null;
|
||||
if (urlConfigOrSource instanceof Observable) {
|
||||
this.destination = destination;
|
||||
this.source = urlConfigOrSource;
|
||||
}
|
||||
else {
|
||||
const config = (this._config = Object.assign({}, DEFAULT_WEBSOCKET_CONFIG));
|
||||
this._output = new Subject();
|
||||
if (typeof urlConfigOrSource === 'string') {
|
||||
config.url = urlConfigOrSource;
|
||||
}
|
||||
else {
|
||||
for (const key in urlConfigOrSource) {
|
||||
if (urlConfigOrSource.hasOwnProperty(key)) {
|
||||
config[key] = urlConfigOrSource[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!config.WebSocketCtor && WebSocket) {
|
||||
config.WebSocketCtor = WebSocket;
|
||||
}
|
||||
else if (!config.WebSocketCtor) {
|
||||
throw new Error('no WebSocket constructor can be found');
|
||||
}
|
||||
this.destination = new ReplaySubject();
|
||||
}
|
||||
}
|
||||
lift(operator) {
|
||||
const sock = new WebSocketSubject(this._config, this.destination);
|
||||
sock.operator = operator;
|
||||
sock.source = this;
|
||||
return sock;
|
||||
}
|
||||
_resetState() {
|
||||
this._socket = null;
|
||||
if (!this.source) {
|
||||
this.destination = new ReplaySubject();
|
||||
}
|
||||
this._output = new Subject();
|
||||
}
|
||||
multiplex(subMsg, unsubMsg, messageFilter) {
|
||||
const self = this;
|
||||
return new Observable((observer) => {
|
||||
try {
|
||||
self.next(subMsg());
|
||||
}
|
||||
catch (err) {
|
||||
observer.error(err);
|
||||
}
|
||||
const subscription = self.subscribe({
|
||||
next: (x) => {
|
||||
try {
|
||||
if (messageFilter(x)) {
|
||||
observer.next(x);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
observer.error(err);
|
||||
}
|
||||
},
|
||||
error: (err) => observer.error(err),
|
||||
complete: () => observer.complete(),
|
||||
});
|
||||
return () => {
|
||||
try {
|
||||
self.next(unsubMsg());
|
||||
}
|
||||
catch (err) {
|
||||
observer.error(err);
|
||||
}
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
}
|
||||
_connectSocket() {
|
||||
const { WebSocketCtor, protocol, url, binaryType } = this._config;
|
||||
const observer = this._output;
|
||||
let socket = null;
|
||||
try {
|
||||
socket = protocol ? new WebSocketCtor(url, protocol) : new WebSocketCtor(url);
|
||||
this._socket = socket;
|
||||
if (binaryType) {
|
||||
this._socket.binaryType = binaryType;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
observer.error(e);
|
||||
return;
|
||||
}
|
||||
const subscription = new Subscription(() => {
|
||||
this._socket = null;
|
||||
if (socket && socket.readyState === 1) {
|
||||
socket.close();
|
||||
}
|
||||
});
|
||||
socket.onopen = (evt) => {
|
||||
const { _socket } = this;
|
||||
if (!_socket) {
|
||||
socket.close();
|
||||
this._resetState();
|
||||
return;
|
||||
}
|
||||
const { openObserver } = this._config;
|
||||
if (openObserver) {
|
||||
openObserver.next(evt);
|
||||
}
|
||||
const queue = this.destination;
|
||||
this.destination = Subscriber.create((x) => {
|
||||
if (socket.readyState === 1) {
|
||||
try {
|
||||
const { serializer } = this._config;
|
||||
socket.send(serializer(x));
|
||||
}
|
||||
catch (e) {
|
||||
this.destination.error(e);
|
||||
}
|
||||
}
|
||||
}, (err) => {
|
||||
const { closingObserver } = this._config;
|
||||
if (closingObserver) {
|
||||
closingObserver.next(undefined);
|
||||
}
|
||||
if (err && err.code) {
|
||||
socket.close(err.code, err.reason);
|
||||
}
|
||||
else {
|
||||
observer.error(new TypeError(WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT));
|
||||
}
|
||||
this._resetState();
|
||||
}, () => {
|
||||
const { closingObserver } = this._config;
|
||||
if (closingObserver) {
|
||||
closingObserver.next(undefined);
|
||||
}
|
||||
socket.close();
|
||||
this._resetState();
|
||||
});
|
||||
if (queue && queue instanceof ReplaySubject) {
|
||||
subscription.add(queue.subscribe(this.destination));
|
||||
}
|
||||
};
|
||||
socket.onerror = (e) => {
|
||||
this._resetState();
|
||||
observer.error(e);
|
||||
};
|
||||
socket.onclose = (e) => {
|
||||
if (socket === this._socket) {
|
||||
this._resetState();
|
||||
}
|
||||
const { closeObserver } = this._config;
|
||||
if (closeObserver) {
|
||||
closeObserver.next(e);
|
||||
}
|
||||
if (e.wasClean) {
|
||||
observer.complete();
|
||||
}
|
||||
else {
|
||||
observer.error(e);
|
||||
}
|
||||
};
|
||||
socket.onmessage = (e) => {
|
||||
try {
|
||||
const { deserializer } = this._config;
|
||||
observer.next(deserializer(e));
|
||||
}
|
||||
catch (err) {
|
||||
observer.error(err);
|
||||
}
|
||||
};
|
||||
}
|
||||
_subscribe(subscriber) {
|
||||
const { source } = this;
|
||||
if (source) {
|
||||
return source.subscribe(subscriber);
|
||||
}
|
||||
if (!this._socket) {
|
||||
this._connectSocket();
|
||||
}
|
||||
this._output.subscribe(subscriber);
|
||||
subscriber.add(() => {
|
||||
const { _socket } = this;
|
||||
if (this._output.observers.length === 0) {
|
||||
if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {
|
||||
_socket.close();
|
||||
}
|
||||
this._resetState();
|
||||
}
|
||||
});
|
||||
return subscriber;
|
||||
}
|
||||
unsubscribe() {
|
||||
const { _socket } = this;
|
||||
if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {
|
||||
_socket.close();
|
||||
}
|
||||
this._resetState();
|
||||
super.unsubscribe();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=WebSocketSubject.js.map
|
1
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/WebSocketSubject.js.map
generated
vendored
Normal file
1
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/WebSocketSubject.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
34
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/animationFrames.js
generated
vendored
Normal file
34
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/animationFrames.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import { Observable } from '../../Observable';
|
||||
import { performanceTimestampProvider } from '../../scheduler/performanceTimestampProvider';
|
||||
import { animationFrameProvider } from '../../scheduler/animationFrameProvider';
|
||||
export function animationFrames(timestampProvider) {
|
||||
return timestampProvider ? animationFramesFactory(timestampProvider) : DEFAULT_ANIMATION_FRAMES;
|
||||
}
|
||||
function animationFramesFactory(timestampProvider) {
|
||||
return new Observable((subscriber) => {
|
||||
const provider = timestampProvider || performanceTimestampProvider;
|
||||
const start = provider.now();
|
||||
let id = 0;
|
||||
const run = () => {
|
||||
if (!subscriber.closed) {
|
||||
id = animationFrameProvider.requestAnimationFrame((timestamp) => {
|
||||
id = 0;
|
||||
const now = provider.now();
|
||||
subscriber.next({
|
||||
timestamp: timestampProvider ? now : timestamp,
|
||||
elapsed: now - start,
|
||||
});
|
||||
run();
|
||||
});
|
||||
}
|
||||
};
|
||||
run();
|
||||
return () => {
|
||||
if (id) {
|
||||
animationFrameProvider.cancelAnimationFrame(id);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
const DEFAULT_ANIMATION_FRAMES = animationFramesFactory();
|
||||
//# sourceMappingURL=animationFrames.js.map
|
1
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/animationFrames.js.map
generated
vendored
Normal file
1
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/animationFrames.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"animationFrames.js","sourceRoot":"","sources":["../../../../../src/internal/observable/dom/animationFrames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAuEhF,MAAM,UAAU,eAAe,CAAC,iBAAqC;IACnE,OAAO,iBAAiB,CAAC,CAAC,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC;AAClG,CAAC;AAMD,SAAS,sBAAsB,CAAC,iBAAqC;IACnE,OAAO,IAAI,UAAU,CAAyC,CAAC,UAAU,EAAE,EAAE;QAI3E,MAAM,QAAQ,GAAG,iBAAiB,IAAI,4BAA4B,CAAC;QAMnE,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;QAE7B,IAAI,EAAE,GAAG,CAAC,CAAC;QACX,MAAM,GAAG,GAAG,GAAG,EAAE;YACf,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;gBACtB,EAAE,GAAG,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,SAAuC,EAAE,EAAE;oBAC5F,EAAE,GAAG,CAAC,CAAC;oBAQP,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACd,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;wBAC9C,OAAO,EAAE,GAAG,GAAG,KAAK;qBACrB,CAAC,CAAC;oBACH,GAAG,EAAE,CAAC;gBACR,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC;QAEF,GAAG,EAAE,CAAC;QAEN,OAAO,GAAG,EAAE;YACV,IAAI,EAAE,EAAE;gBACN,sBAAsB,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;aACjD;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAMD,MAAM,wBAAwB,GAAG,sBAAsB,EAAE,CAAC"}
|
53
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/fetch.js
generated
vendored
Normal file
53
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/fetch.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
import { __rest } from "tslib";
|
||||
import { createOperatorSubscriber } from '../../operators/OperatorSubscriber';
|
||||
import { Observable } from '../../Observable';
|
||||
import { innerFrom } from '../../observable/innerFrom';
|
||||
export function fromFetch(input, initWithSelector = {}) {
|
||||
const { selector } = initWithSelector, init = __rest(initWithSelector, ["selector"]);
|
||||
return new Observable((subscriber) => {
|
||||
const controller = new AbortController();
|
||||
const { signal } = controller;
|
||||
let abortable = true;
|
||||
const { signal: outerSignal } = init;
|
||||
if (outerSignal) {
|
||||
if (outerSignal.aborted) {
|
||||
controller.abort();
|
||||
}
|
||||
else {
|
||||
const outerSignalHandler = () => {
|
||||
if (!signal.aborted) {
|
||||
controller.abort();
|
||||
}
|
||||
};
|
||||
outerSignal.addEventListener('abort', outerSignalHandler);
|
||||
subscriber.add(() => outerSignal.removeEventListener('abort', outerSignalHandler));
|
||||
}
|
||||
}
|
||||
const perSubscriberInit = Object.assign(Object.assign({}, init), { signal });
|
||||
const handleError = (err) => {
|
||||
abortable = false;
|
||||
subscriber.error(err);
|
||||
};
|
||||
fetch(input, perSubscriberInit)
|
||||
.then((response) => {
|
||||
if (selector) {
|
||||
innerFrom(selector(response)).subscribe(createOperatorSubscriber(subscriber, undefined, () => {
|
||||
abortable = false;
|
||||
subscriber.complete();
|
||||
}, handleError));
|
||||
}
|
||||
else {
|
||||
abortable = false;
|
||||
subscriber.next(response);
|
||||
subscriber.complete();
|
||||
}
|
||||
})
|
||||
.catch(handleError);
|
||||
return () => {
|
||||
if (abortable) {
|
||||
controller.abort();
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=fetch.js.map
|
1
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/fetch.js.map
generated
vendored
Normal file
1
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/fetch.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../src/internal/observable/dom/fetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AA4FvD,MAAM,UAAU,SAAS,CACvB,KAAuB,EACvB,mBAEI,EAAE;IAEN,MAAM,EAAE,QAAQ,KAAc,gBAAgB,EAAzB,IAAI,UAAK,gBAAgB,EAAxC,YAAqB,CAAmB,CAAC;IAC/C,OAAO,IAAI,UAAU,CAAe,CAAC,UAAU,EAAE,EAAE;QAKjD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QAK9B,IAAI,SAAS,GAAG,IAAI,CAAC;QAKrB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QACrC,IAAI,WAAW,EAAE;YACf,IAAI,WAAW,CAAC,OAAO,EAAE;gBACvB,UAAU,CAAC,KAAK,EAAE,CAAC;aACpB;iBAAM;gBAGL,MAAM,kBAAkB,GAAG,GAAG,EAAE;oBAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;wBACnB,UAAU,CAAC,KAAK,EAAE,CAAC;qBACpB;gBACH,CAAC,CAAC;gBACF,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;gBAC1D,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;aACpF;SACF;QAOD,MAAM,iBAAiB,mCAAqB,IAAI,KAAE,MAAM,GAAE,CAAC;QAE3D,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAE,EAAE;YAC/B,SAAS,GAAG,KAAK,CAAC;YAClB,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC;QAEF,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC;aAC5B,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,IAAI,QAAQ,EAAE;gBAIZ,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CACrC,wBAAwB,CACtB,UAAU,EAEV,SAAS,EAET,GAAG,EAAE;oBACH,SAAS,GAAG,KAAK,CAAC;oBAClB,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACxB,CAAC,EACD,WAAW,CACZ,CACF,CAAC;aACH;iBAAM;gBACL,SAAS,GAAG,KAAK,CAAC;gBAClB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC1B,UAAU,CAAC,QAAQ,EAAE,CAAC;aACvB;QACH,CAAC,CAAC;aACD,KAAK,CAAC,WAAW,CAAC,CAAC;QAEtB,OAAO,GAAG,EAAE;YACV,IAAI,SAAS,EAAE;gBACb,UAAU,CAAC,KAAK,EAAE,CAAC;aACpB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
5
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/webSocket.js
generated
vendored
Normal file
5
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/webSocket.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { WebSocketSubject } from './WebSocketSubject';
|
||||
export function webSocket(urlConfigOrSource) {
|
||||
return new WebSocketSubject(urlConfigOrSource);
|
||||
}
|
||||
//# sourceMappingURL=webSocket.js.map
|
1
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/webSocket.js.map
generated
vendored
Normal file
1
VApp/node_modules/rxjs/dist/esm/internal/observable/dom/webSocket.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"webSocket.js","sourceRoot":"","sources":["../../../../../src/internal/observable/dom/webSocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,oBAAoB,CAAC;AA+J9E,MAAM,UAAU,SAAS,CAAI,iBAAqD;IAChF,OAAO,IAAI,gBAAgB,CAAI,iBAAiB,CAAC,CAAC;AACpD,CAAC"}
|
Reference in New Issue
Block a user