@babylonjs/core 5.22.0 → 5.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +1 -0
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +2 -0
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -0
- package/Materials/Node/nodeMaterial.js +1 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +1 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +4 -1
- package/Materials/Textures/renderTargetTexture.js +15 -28
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/imageProcessingConfiguration.d.ts +22 -0
- package/Materials/imageProcessingConfiguration.js +68 -13
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -0
- package/Materials/standardMaterial.js +1 -0
- package/Materials/standardMaterial.js.map +1 -1
- package/Misc/arrayTools.d.ts +12 -0
- package/Misc/arrayTools.js +44 -0
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/fileTools.d.ts +4 -0
- package/Misc/fileTools.js +14 -2
- package/Misc/fileTools.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/logger.d.ts +1 -4
- package/Misc/logger.js +28 -66
- package/Misc/logger.js.map +1 -1
- package/Misc/observable.d.ts +9 -37
- package/Misc/observable.extensions.d.ts +41 -0
- package/Misc/observable.extensions.js +82 -0
- package/Misc/observable.extensions.js.map +1 -0
- package/Misc/observable.js +4 -95
- package/Misc/observable.js.map +1 -1
- package/Navigation/Plugins/recastJSPlugin.d.ts +11 -0
- package/Navigation/Plugins/recastJSPlugin.js +19 -1
- package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.d.ts +2 -0
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +20 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.d.ts +16 -0
- package/PostProcesses/imageProcessingPostProcess.js +25 -0
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/Rendering/edgesRenderer.js +1 -1
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/imageProcessingDeclaration.js +5 -1
- package/Shaders/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/imageProcessingFunctions.js +2 -0
- package/Shaders/ShadersInclude/imageProcessingFunctions.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +8 -1
- package/scene.js +13 -2
- package/scene.js.map +1 -1
package/Misc/arrayTools.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Observable } from "./observable";
|
|
2
|
+
import type { Nullable } from "../types";
|
|
1
3
|
/** @hidden */
|
|
2
4
|
interface TupleTypes<T> {
|
|
3
5
|
2: [T, T];
|
|
@@ -15,6 +17,10 @@ interface TupleTypes<T> {
|
|
|
15
17
|
14: [T, T, T, T, T, T, T, T, T, T, T, T, T, T];
|
|
16
18
|
15: [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];
|
|
17
19
|
}
|
|
20
|
+
export interface INotifyArrayChangeType<T> {
|
|
21
|
+
target: Nullable<Array<T>>;
|
|
22
|
+
previousLength?: number;
|
|
23
|
+
}
|
|
18
24
|
/**
|
|
19
25
|
* Class containing a set of static utilities functions for arrays.
|
|
20
26
|
*/
|
|
@@ -33,5 +39,11 @@ export declare class ArrayTools {
|
|
|
33
39
|
* @returns a new tuple filled with new objects.
|
|
34
40
|
*/
|
|
35
41
|
static BuildTuple<T, N extends keyof TupleTypes<unknown>>(size: N, itemBuilder: () => T): TupleTypes<T>[N];
|
|
42
|
+
private static _ProxySet;
|
|
43
|
+
private static _ProxyPushOrUnshift;
|
|
44
|
+
private static _ProxyDelete;
|
|
45
|
+
private static _ProxyPopOrShift;
|
|
46
|
+
private static _ProxySplice;
|
|
47
|
+
static MakeObservableArray<T>(observable: Observable<INotifyArrayChangeType<T>>, initialArray: Nullable<Array<T>>): Nullable<T[]>;
|
|
36
48
|
}
|
|
37
49
|
export {};
|
package/Misc/arrayTools.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
/**
|
|
2
3
|
* Class containing a set of static utilities functions for arrays.
|
|
3
4
|
*/
|
|
@@ -24,5 +25,48 @@ export class ArrayTools {
|
|
|
24
25
|
static BuildTuple(size, itemBuilder) {
|
|
25
26
|
return ArrayTools.BuildArray(size, itemBuilder);
|
|
26
27
|
}
|
|
28
|
+
static _ProxySet(observable, target, property, value) {
|
|
29
|
+
observable.notifyObservers({ target, previousLength: target.length });
|
|
30
|
+
return Reflect.set(target, property, value);
|
|
31
|
+
}
|
|
32
|
+
static _ProxyPushOrUnshift(operation, observable, target, ...values) {
|
|
33
|
+
observable.notifyObservers({ target, previousLength: target.length });
|
|
34
|
+
return operation === "push" ? Array.prototype.push.apply(target, values) : Array.prototype.unshift.apply(target, values);
|
|
35
|
+
}
|
|
36
|
+
static _ProxyDelete(observable, target, property) {
|
|
37
|
+
observable.notifyObservers({ target, previousLength: target.length });
|
|
38
|
+
return Reflect.deleteProperty(target, property);
|
|
39
|
+
}
|
|
40
|
+
static _ProxyPopOrShift(operation, observable, target) {
|
|
41
|
+
const value = operation === "pop" ? Array.prototype.pop.apply(target) : Array.prototype.shift.apply(target);
|
|
42
|
+
observable.notifyObservers({ target, previousLength: target.length });
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
static _ProxySplice(observable, target, start, deleteNumber, ...added) {
|
|
46
|
+
const values = Array.prototype.splice.apply(target, [start, deleteNumber, added]);
|
|
47
|
+
observable.notifyObservers({ target, previousLength: target.length });
|
|
48
|
+
return values;
|
|
49
|
+
}
|
|
50
|
+
static MakeObservableArray(observable, initialArray) {
|
|
51
|
+
let returnObject;
|
|
52
|
+
if (initialArray && !Object.prototype.hasOwnProperty.call(initialArray, "isObserved")) {
|
|
53
|
+
const _proxyObject = {
|
|
54
|
+
set: (target, property, value) => ArrayTools._ProxySet(observable, target, property, value),
|
|
55
|
+
push: (target, ...values) => ArrayTools._ProxyPushOrUnshift("push", observable, target, ...values),
|
|
56
|
+
unshift: (target, ...values) => ArrayTools._ProxyPushOrUnshift("unshift", observable, target, ...values),
|
|
57
|
+
delete: (target, property) => ArrayTools._ProxyDelete(observable, target, property),
|
|
58
|
+
pop: (target) => ArrayTools._ProxyPopOrShift("pop", observable, target),
|
|
59
|
+
shift: (target) => ArrayTools._ProxyPopOrShift("shift", observable, target),
|
|
60
|
+
splice: (target, start, deleteNumber, ...added) => ArrayTools._ProxySplice(observable, target, start, deleteNumber, ...added),
|
|
61
|
+
isObserved: true,
|
|
62
|
+
};
|
|
63
|
+
returnObject = new Proxy(initialArray, _proxyObject);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
returnObject = initialArray;
|
|
67
|
+
}
|
|
68
|
+
observable.notifyObservers({ target: returnObject });
|
|
69
|
+
return returnObject;
|
|
70
|
+
}
|
|
27
71
|
}
|
|
28
72
|
//# sourceMappingURL=arrayTools.js.map
|
package/Misc/arrayTools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayTools.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/arrayTools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arrayTools.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/arrayTools.ts"],"names":[],"mappings":"AAAA,yDAAyD;AA4BzD;;GAEG;AACH,MAAM,OAAO,UAAU;IACnB;;;;;OAKG;IACI,MAAM,CAAC,UAAU,CAAI,IAAY,EAAE,WAAoB;QAC1D,MAAM,CAAC,GAAQ,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;YAC3B,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;SACzB;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,UAAU,CAAyC,IAAO,EAAE,WAAoB;QAC1F,OAAO,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAQ,CAAC;IAC3D,CAAC;IAEO,MAAM,CAAC,SAAS,CAAI,UAAiD,EAAE,MAAgB,EAAE,QAAyB,EAAE,KAAQ;QAChI,UAAU,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACtE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAEO,MAAM,CAAC,mBAAmB,CAAI,SAA6B,EAAE,UAAiD,EAAE,MAAgB,EAAE,GAAG,MAAgB;QACzJ,UAAU,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAA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I;aACnB,CAAC;YAEF,YAAY,GAAG,IAAI,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;SACxD;aAAM;YACH,YAAY,GAAG,YAAY,CAAC;SAC/B;QACD,UAAU,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;QACrD,OAAO,YAAY,CAAC;IACxB,CAAC;CACJ","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport type { Observable } from \"./observable\";\r\nimport type { Nullable } from \"../types\";\r\n\r\n/** @hidden */\r\ninterface TupleTypes<T> {\r\n 2: [T, T];\r\n 3: [T, T, T];\r\n 4: [T, T, T, T];\r\n 5: [T, T, T, T, T];\r\n 6: [T, T, T, T, T, T];\r\n 7: [T, T, T, T, T, T, T];\r\n 8: [T, T, T, T, T, T, T, T];\r\n 9: [T, T, T, T, T, T, T, T, T];\r\n 10: [T, T, T, T, T, T, T, T, T, T];\r\n 11: [T, T, T, T, T, T, T, T, T, T, T];\r\n 12: [T, T, T, T, T, T, T, T, T, T, T, T];\r\n 13: [T, T, T, T, T, T, T, T, T, T, T, T, T];\r\n 14: [T, T, T, T, T, T, T, T, T, T, T, T, T, T];\r\n 15: [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];\r\n}\r\n\r\nexport interface INotifyArrayChangeType<T> {\r\n target: Nullable<Array<T>>;\r\n previousLength?: number; // If the array was previously null/undefined, this will be undefined\r\n}\r\n\r\n/**\r\n * Class containing a set of static utilities functions for arrays.\r\n */\r\nexport class ArrayTools {\r\n /**\r\n * Returns an array of the given size filled with elements built from the given constructor and the parameters.\r\n * @param size the number of element to construct and put in the array.\r\n * @param itemBuilder a callback responsible for creating new instance of item. Called once per array entry.\r\n * @returns a new array filled with new objects.\r\n */\r\n public static BuildArray<T>(size: number, itemBuilder: () => T): Array<T> {\r\n const a: T[] = [];\r\n for (let i = 0; i < size; ++i) {\r\n a.push(itemBuilder());\r\n }\r\n return a;\r\n }\r\n\r\n /**\r\n * Returns a tuple of the given size filled with elements built from the given constructor and the parameters.\r\n * @param size he number of element to construct and put in the tuple.\r\n * @param itemBuilder a callback responsible for creating new instance of item. Called once per tuple entry.\r\n * @returns a new tuple filled with new objects.\r\n */\r\n public static BuildTuple<T, N extends keyof TupleTypes<unknown>>(size: N, itemBuilder: () => T): TupleTypes<T>[N] {\r\n return ArrayTools.BuildArray(size, itemBuilder) as any;\r\n }\r\n\r\n private static _ProxySet<T>(observable: Observable<INotifyArrayChangeType<T>>, target: Array<T>, property: string | symbol, value: T): boolean {\r\n observable.notifyObservers({ target, previousLength: target.length });\r\n return Reflect.set(target, property, value);\r\n }\r\n\r\n private static _ProxyPushOrUnshift<T>(operation: \"push\" | \"unshift\", observable: Observable<INotifyArrayChangeType<T>>, target: Array<T>, ...values: Array<T>): number {\r\n observable.notifyObservers({ target, previousLength: target.length });\r\n return operation === \"push\" ? Array.prototype.push.apply(target, values) : Array.prototype.unshift.apply(target, values);\r\n }\r\n\r\n private static _ProxyDelete<T>(observable: Observable<INotifyArrayChangeType<T>>, target: Array<T>, property: string | symbol) {\r\n observable.notifyObservers({ target, previousLength: target.length });\r\n return Reflect.deleteProperty(target, property);\r\n }\r\n\r\n private static _ProxyPopOrShift<T>(operation: \"pop\" | \"shift\", observable: Observable<INotifyArrayChangeType<T>>, target: Array<T>) {\r\n const value = operation === \"pop\" ? Array.prototype.pop.apply(target) : Array.prototype.shift.apply(target);\r\n observable.notifyObservers({ target, previousLength: target.length });\r\n return value;\r\n }\r\n\r\n private static _ProxySplice<T>(observable: Observable<INotifyArrayChangeType<T>>, target: Array<T>, start: number, deleteNumber: number, ...added: Array<T>) {\r\n const values = Array.prototype.splice.apply(target, [start, deleteNumber, added]);\r\n observable.notifyObservers({ target, previousLength: target.length });\r\n return values;\r\n }\r\n\r\n public static MakeObservableArray<T>(observable: Observable<INotifyArrayChangeType<T>>, initialArray: Nullable<Array<T>>) {\r\n let returnObject;\r\n if (initialArray && !Object.prototype.hasOwnProperty.call(initialArray, \"isObserved\")) {\r\n const _proxyObject = {\r\n set: (target: Array<T>, property: string | symbol, value: T) => ArrayTools._ProxySet(observable, target, property, value),\r\n push: (target: Array<T>, ...values: Array<T>) => ArrayTools._ProxyPushOrUnshift(\"push\", observable, target, ...values),\r\n unshift: (target: Array<T>, ...values: Array<T>) => ArrayTools._ProxyPushOrUnshift(\"unshift\", observable, target, ...values),\r\n delete: (target: Array<T>, property: string | symbol) => ArrayTools._ProxyDelete(observable, target, property),\r\n pop: (target: Array<T>) => ArrayTools._ProxyPopOrShift(\"pop\", observable, target),\r\n shift: (target: Array<T>) => ArrayTools._ProxyPopOrShift(\"shift\", observable, target),\r\n splice: (target: Array<T>, start: number, deleteNumber: number, ...added: Array<T>) => ArrayTools._ProxySplice(observable, target, start, deleteNumber, ...added),\r\n isObserved: true,\r\n };\r\n\r\n returnObject = new Proxy(initialArray, _proxyObject);\r\n } else {\r\n returnObject = initialArray;\r\n }\r\n observable.notifyObservers({ target: returnObject });\r\n return returnObject;\r\n }\r\n}\r\n"]}
|
package/Misc/fileTools.d.ts
CHANGED
|
@@ -115,6 +115,10 @@ export declare const IsFileURL: () => boolean;
|
|
|
115
115
|
* @hidden
|
|
116
116
|
*/
|
|
117
117
|
export declare const IsBase64DataUrl: (uri: string) => boolean;
|
|
118
|
+
export declare const TestBase64DataUrl: (uri: string) => {
|
|
119
|
+
match: boolean;
|
|
120
|
+
type: string;
|
|
121
|
+
};
|
|
118
122
|
/**
|
|
119
123
|
* Decode the given base64 uri.
|
|
120
124
|
* @param uri The uri to decode
|
package/Misc/fileTools.js
CHANGED
|
@@ -316,13 +316,15 @@ export const LoadFile = (fileOrUrl, onSuccess, onProgress, offlineProvider, useA
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
// For a Base64 Data URL
|
|
319
|
-
|
|
319
|
+
const { match, type } = TestBase64DataUrl(url);
|
|
320
|
+
if (match) {
|
|
320
321
|
const fileRequest = {
|
|
321
322
|
onCompleteObservable: new Observable(),
|
|
322
323
|
abort: () => () => { }
|
|
323
324
|
};
|
|
324
325
|
try {
|
|
325
|
-
|
|
326
|
+
const data = useArrayBuffer ? DecodeBase64UrlToBinary(url) : DecodeBase64UrlToString(url);
|
|
327
|
+
onSuccess(data, undefined, type);
|
|
326
328
|
}
|
|
327
329
|
catch (error) {
|
|
328
330
|
if (onError) {
|
|
@@ -535,6 +537,16 @@ export const IsFileURL = () => {
|
|
|
535
537
|
export const IsBase64DataUrl = (uri) => {
|
|
536
538
|
return Base64DataUrlRegEx.test(uri);
|
|
537
539
|
};
|
|
540
|
+
export const TestBase64DataUrl = (uri) => {
|
|
541
|
+
const results = Base64DataUrlRegEx.exec(uri);
|
|
542
|
+
if (results === null || results.length === 0) {
|
|
543
|
+
return { match: false, type: "" };
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
const type = results[0].replace("data:", "").replace("base64,", "");
|
|
547
|
+
return { match: true, type };
|
|
548
|
+
}
|
|
549
|
+
};
|
|
538
550
|
/**
|
|
539
551
|
* Decode the given base64 uri.
|
|
540
552
|
* @param uri The uri to decode
|
package/Misc/fileTools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileTools.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/fileTools.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,e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GAAG,KAAK,CAAC;QAC1C,CAAC;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AACF,mBAAmB,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { WebRequest } from \"./webRequest\";\nimport { IsWindowObjectExist } from \"./domManagement\";\nimport type { Nullable } from \"../types\";\nimport type { IOfflineProvider } from \"../Offline/IOfflineProvider\";\nimport type { IFileRequest } from \"./fileRequest\";\nimport { Observable } from \"./observable\";\nimport { FilesInputStore } from \"./filesInputStore\";\nimport { RetryStrategy } from \"./retryStrategy\";\nimport { BaseError, ErrorCodes, RuntimeError } from \"./error\";\nimport { DecodeBase64ToBinary, DecodeBase64ToString, EncodeArrayBufferToBase64 } from \"./stringTools\";\nimport { ShaderProcessor } from \"../Engines/Processors/shaderProcessor\";\nimport { ThinEngine } from \"../Engines/thinEngine\";\nimport { EngineStore } from \"../Engines/engineStore\";\nimport { Logger } from \"./logger\";\nimport { TimingTools } from \"./timingTools\";\nconst Base64DataUrlRegEx = new RegExp(/^data:([^,]+\\/[^,]+)?;base64,/i);\n/** @ignore */\nexport class LoadFileError extends RuntimeError {\n public request?: WebRequest;\n public file?: File;\n /**\n * Creates a new LoadFileError\n * @param message defines the message of the error\n * @param object defines the optional web request\n */\n constructor(message: string, object?: WebRequest | File) {\n super(message, ErrorCodes.LoadFileError);\n this.name = \"LoadFileError\";\n BaseError._setPrototypeOf(this, LoadFileError.prototype);\n if (object instanceof WebRequest) {\n this.request = object;\n }\n else {\n this.file = object;\n }\n }\n}\n/** @ignore */\nexport class RequestFileError extends RuntimeError {\n /**\n * Creates a new LoadFileError\n * @param message defines the message of the error\n * @param request defines the optional web request\n */\n constructor(message: string, public request: WebRequest) {\n super(message, ErrorCodes.RequestFileError);\n this.name = \"RequestFileError\";\n BaseError._setPrototypeOf(this, RequestFileError.prototype);\n }\n}\n/** @ignore */\nexport class ReadFileError extends RuntimeError {\n /**\n * Creates a new ReadFileError\n * @param message defines the message of the error\n * @param file defines the optional file\n */\n constructor(message: string, public file: File) {\n super(message, ErrorCodes.ReadFileError);\n this.name = \"ReadFileError\";\n BaseError._setPrototypeOf(this, ReadFileError.prototype);\n }\n}\n/**\n * @hidden\n */\nexport const FileToolsOptions: {\n DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;\n BaseUrl: string;\n CorsBehavior: string | ((url: string | string[]) => string);\n PreprocessUrl: (url: string) => string;\n} = {\n /**\n * Gets or sets the retry strategy to apply when an error happens while loading an asset.\n * When defining this function, return the wait time before trying again or return -1 to\n * stop retrying and error out.\n */\n DefaultRetryStrategy: RetryStrategy.ExponentialBackoff(),\n /**\n * Gets or sets the base URL to use to load assets\n */\n BaseUrl: \"\",\n /**\n * Default behaviour for cors in the application.\n * It can be a string if the expected behavior is identical in the entire app.\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\n */\n CorsBehavior: \"anonymous\",\n /**\n * Gets or sets a function used to pre-process url before using them to load assets\n * @param url\n */\n PreprocessUrl: (url: string) => {\n return url;\n }\n};\n/**\n * Removes unwanted characters from an url\n * @param url defines the url to clean\n * @returns the cleaned url\n */\nconst _CleanUrl = (url: string): string => {\n url = url.replace(/#/gm, \"%23\");\n return url;\n};\n/**\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\n * @param url define the url we are trying\n * @param element define the dom element where to configure the cors policy\n * @param element.crossOrigin\n * @hidden\n */\nexport const SetCorsBehavior = (url: string | string[], element: {\n crossOrigin: string | null;\n}): void => {\n if (url && url.indexOf(\"data:\") === 0) {\n return;\n }\n if (FileToolsOptions.CorsBehavior) {\n if (typeof FileToolsOptions.CorsBehavior === \"string\" || FileToolsOptions.CorsBehavior instanceof String) {\n element.crossOrigin = <string>FileToolsOptions.CorsBehavior;\n }\n else {\n const result = FileToolsOptions.CorsBehavior(url);\n if (result) {\n element.crossOrigin = result;\n }\n }\n }\n};\n/**\n * Loads an image as an HTMLImageElement.\n * @param input url string, ArrayBuffer, or Blob to load\n * @param onLoad callback called when the image successfully loads\n * @param onError callback called when the image fails to load\n * @param offlineProvider offline provider for caching\n * @param mimeType optional mime type\n * @param imageBitmapOptions\n * @returns the HTMLImageElement of the loaded image\n * @hidden\n */\nexport const LoadImage = (input: string | ArrayBuffer | ArrayBufferView | Blob, onLoad: (img: HTMLImageElement | ImageBitmap) => void, onError: (message?: string, exception?: any) => void, offlineProvider: Nullable<IOfflineProvider>, mimeType: string = \"\", imageBitmapOptions?: ImageBitmapOptions): Nullable<HTMLImageElement> => {\n let url: string;\n let usingObjectURL = false;\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\n if (typeof Blob !== \"undefined\" && typeof URL !== \"undefined\") {\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\n usingObjectURL = true;\n }\n else {\n url = `data:${mimeType};base64,` + EncodeArrayBufferToBase64(input);\n }\n }\n else if (input instanceof Blob) {\n url = URL.createObjectURL(input);\n usingObjectURL = true;\n }\n else {\n url = _CleanUrl(input);\n url = FileToolsOptions.PreprocessUrl(input);\n }\n const engine = EngineStore.LastCreatedEngine;\n const onErrorHandler = (exception: any) => {\n if (onError) {\n const inputText = url || input.toString();\n onError(`Error while trying to load image: ${inputText.indexOf(\"http\") === 0 || inputText.length <= 128 ? inputText : inputText.slice(0, 128) + \"...\"}`, exception);\n }\n };\n if (typeof Image === \"undefined\" || (engine?._features.forceBitmapOverHTMLImageElement ?? false)) {\n LoadFile(url, (data) => {\n engine!\n .createImageBitmap(new Blob([data], { type: mimeType }), { premultiplyAlpha: \"none\", ...imageBitmapOptions })\n .then((imgBmp) => {\n onLoad(imgBmp);\n if (usingObjectURL) {\n URL.revokeObjectURL(url);\n }\n })\n .catch((reason) => {\n if (onError) {\n onError(\"Error while trying to load image: \" + input, reason);\n }\n });\n }, undefined, offlineProvider || undefined, true, (request, exception) => {\n onErrorHandler(exception);\n });\n return null;\n }\n const img = new Image();\n SetCorsBehavior(url, img);\n const loadHandler = () => {\n img.removeEventListener(\"load\", loadHandler);\n img.removeEventListener(\"error\", errorHandler);\n onLoad(img);\n // Must revoke the URL after calling onLoad to avoid security exceptions in\n // certain scenarios (e.g. when hosted in vscode).\n if (usingObjectURL && img.src) {\n URL.revokeObjectURL(img.src);\n }\n };\n const errorHandler = (err: any) => {\n img.removeEventListener(\"load\", loadHandler);\n img.removeEventListener(\"error\", errorHandler);\n onErrorHandler(err);\n if (usingObjectURL && img.src) {\n URL.revokeObjectURL(img.src);\n }\n };\n img.addEventListener(\"load\", loadHandler);\n img.addEventListener(\"error\", errorHandler);\n const noOfflineSupport = () => {\n LoadFile(url, (data, _, contentType) => {\n const type = !mimeType && contentType ? contentType : mimeType;\n const blob = new Blob([data], { type });\n const url = URL.createObjectURL(blob);\n usingObjectURL = true;\n img.src = url;\n }, undefined, offlineProvider || undefined, true, (request, exception) => {\n onErrorHandler(exception);\n });\n };\n const loadFromOfflineSupport = () => {\n if (offlineProvider) {\n offlineProvider.loadImage(url, img);\n }\n };\n if (url.substr(0, 5) !== \"blob:\" && url.substr(0, 5) !== \"data:\" && offlineProvider && offlineProvider.enableTexturesOffline) {\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\n }\n else {\n if (url.indexOf(\"file:\") !== -1) {\n const textureName = decodeURIComponent(url.substring(5).toLowerCase());\n if (FilesInputStore.FilesToLoad[textureName] && typeof URL !== \"undefined\") {\n try {\n let blobURL;\n try {\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\n }\n catch (ex) {\n // Chrome doesn't support oneTimeOnly parameter\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\n }\n img.src = blobURL;\n usingObjectURL = true;\n }\n catch (e) {\n img.src = \"\";\n }\n return img;\n }\n }\n noOfflineSupport();\n }\n return img;\n};\n/**\n * Reads a file from a File object\n * @param file defines the file to load\n * @param onSuccess defines the callback to call when data is loaded\n * @param onProgress defines the callback to call during loading process\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\n * @param onError defines the callback to call when an error occurs\n * @returns a file request object\n * @hidden\n */\nexport const ReadFile = (file: File, onSuccess: (data: any) => void, onProgress?: (ev: ProgressEvent) => any, useArrayBuffer?: boolean, onError?: (error: ReadFileError) => void): IFileRequest => {\n const reader = new FileReader();\n const fileRequest: IFileRequest = {\n onCompleteObservable: new Observable<IFileRequest>(),\n abort: () => reader.abort()\n };\n reader.onloadend = () => fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n if (onError) {\n reader.onerror = () => {\n onError(new ReadFileError(`Unable to read ${file.name}`, file));\n };\n }\n reader.onload = (e) => {\n //target doesn't have result from ts 1.3\n onSuccess((<any>e.target)[\"result\"]);\n };\n if (onProgress) {\n reader.onprogress = onProgress;\n }\n if (!useArrayBuffer) {\n // Asynchronous read\n reader.readAsText(file);\n }\n else {\n reader.readAsArrayBuffer(file);\n }\n return fileRequest;\n};\n/**\n * Loads a file from a url, a data url, or a file url\n * @param fileOrUrl file, url, data url, or file url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @param onOpened\n * @returns a file request object\n * @hidden\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const LoadFile = (fileOrUrl: File | string, onSuccess: (data: string | ArrayBuffer, responseURL?: string, contentType?: Nullable<string>) => void, onProgress?: (ev: ProgressEvent) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void, onOpened?: (request: WebRequest) => void): IFileRequest => {\n if ((fileOrUrl as File).name) {\n return ReadFile(fileOrUrl as File, onSuccess, onProgress, useArrayBuffer, onError\n ? (error: ReadFileError) => {\n onError(undefined, error);\n }\n : undefined);\n }\n const url = fileOrUrl as string;\n // If file and file input are set\n if (url.indexOf(\"file:\") !== -1) {\n let fileName = decodeURIComponent(url.substring(5).toLowerCase());\n if (fileName.indexOf(\"./\") === 0) {\n fileName = fileName.substring(2);\n }\n const file = FilesInputStore.FilesToLoad[fileName];\n if (file) {\n return ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? (error) => onError(undefined, new LoadFileError(error.message, error.file)) : undefined);\n }\n }\n // For a Base64 Data URL\n if (IsBase64DataUrl(url)) {\n const fileRequest: IFileRequest = {\n onCompleteObservable: new Observable<IFileRequest>(),\n abort: () => () => { }\n };\n try {\n onSuccess(useArrayBuffer ? DecodeBase64UrlToBinary(url) : DecodeBase64UrlToString(url));\n }\n catch (error) {\n if (onError) {\n onError(undefined, error);\n }\n else {\n Logger.Error(error.message || \"Failed to parse the Data URL\");\n }\n }\n TimingTools.SetImmediate(() => {\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n });\n return fileRequest;\n }\n return RequestFile(url, (data, request) => {\n onSuccess(data, request?.responseURL, request?.getResponseHeader(\"content-type\"));\n }, onProgress, offlineProvider, useArrayBuffer, onError\n ? (error) => {\n onError(error.request, new LoadFileError(error.message, error.request));\n }\n : undefined, onOpened);\n};\n/**\n * Loads a file from a url\n * @param url url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @param onOpened callback called when the web request is opened\n * @returns a file request object\n * @hidden\n */\nexport const RequestFile = (url: string, onSuccess?: (data: string | ArrayBuffer, request?: WebRequest) => void, onProgress?: (event: ProgressEvent) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (error: RequestFileError) => void, onOpened?: (request: WebRequest) => void): IFileRequest => {\n url = _CleanUrl(url);\n url = FileToolsOptions.PreprocessUrl(url);\n const loadUrl = FileToolsOptions.BaseUrl + url;\n let aborted = false;\n const fileRequest: IFileRequest = {\n onCompleteObservable: new Observable<IFileRequest>(),\n abort: () => (aborted = true)\n };\n const requestFile = () => {\n let request: Nullable<WebRequest> = new WebRequest();\n let retryHandle: Nullable<ReturnType<typeof setTimeout>> = null;\n let onReadyStateChange: Nullable<() => void>;\n const unbindEvents = () => {\n if (!request) {\n return;\n }\n if (onProgress) {\n request.removeEventListener(\"progress\", onProgress);\n }\n if (onReadyStateChange) {\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\n }\n request.removeEventListener(\"loadend\", onLoadEnd!);\n };\n let onLoadEnd: Nullable<() => void> = () => {\n unbindEvents();\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n fileRequest.onCompleteObservable.clear();\n onProgress = undefined;\n onReadyStateChange = null;\n onLoadEnd = null;\n onError = undefined;\n onOpened = undefined;\n onSuccess = undefined;\n };\n fileRequest.abort = () => {\n aborted = true;\n if (onLoadEnd) {\n onLoadEnd();\n }\n if (request && request.readyState !== (XMLHttpRequest.DONE || 4)) {\n request.abort();\n }\n if (retryHandle !== null) {\n clearTimeout(retryHandle);\n retryHandle = null;\n }\n request = null;\n };\n const handleError = (error: any) => {\n const message = error.message || \"Unknown error\";\n if (onError && request) {\n onError(new RequestFileError(message, request));\n }\n else {\n Logger.Error(message);\n }\n };\n const retryLoop = (retryIndex: number) => {\n if (!request) {\n return;\n }\n request.open(\"GET\", loadUrl);\n if (onOpened) {\n try {\n onOpened(request);\n }\n catch (e) {\n handleError(e);\n return;\n }\n }\n if (useArrayBuffer) {\n request.responseType = \"arraybuffer\";\n }\n if (onProgress) {\n request.addEventListener(\"progress\", onProgress);\n }\n if (onLoadEnd) {\n request.addEventListener(\"loadend\", onLoadEnd);\n }\n onReadyStateChange = () => {\n if (aborted || !request) {\n return;\n }\n // In case of undefined state in some browsers.\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\n if (onReadyStateChange) {\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\n }\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!IsWindowObjectExist() || IsFileURL()))) {\n try {\n if (onSuccess) {\n onSuccess(useArrayBuffer ? request.response : request.responseText, request);\n }\n }\n catch (e) {\n handleError(e);\n }\n return;\n }\n const retryStrategy = FileToolsOptions.DefaultRetryStrategy;\n if (retryStrategy) {\n const waitTime = retryStrategy(loadUrl, request, retryIndex);\n if (waitTime !== -1) {\n // Prevent the request from completing for retry.\n unbindEvents();\n request = new WebRequest();\n retryHandle = setTimeout(() => retryLoop(retryIndex + 1), waitTime);\n return;\n }\n }\n const error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\n if (onError) {\n onError(error);\n }\n }\n };\n request.addEventListener(\"readystatechange\", onReadyStateChange);\n request.send();\n };\n retryLoop(0);\n };\n // Caching all files\n if (offlineProvider && offlineProvider.enableSceneOffline) {\n const noOfflineSupport = (request?: any) => {\n if (request && request.status > 400) {\n if (onError) {\n onError(request);\n }\n }\n else {\n requestFile();\n }\n };\n const loadFromOfflineSupport = () => {\n // TODO: database needs to support aborting and should return a IFileRequest\n if (offlineProvider) {\n offlineProvider.loadFile(FileToolsOptions.BaseUrl + url, (data) => {\n if (!aborted && onSuccess) {\n onSuccess(data);\n }\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n }, onProgress\n ? (event) => {\n if (!aborted && onProgress) {\n onProgress(event);\n }\n }\n : undefined, noOfflineSupport, useArrayBuffer);\n }\n };\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\n }\n else {\n requestFile();\n }\n return fileRequest;\n};\n/**\n * Checks if the loaded document was accessed via `file:`-Protocol.\n * @returns boolean\n * @hidden\n */\nexport const IsFileURL = (): boolean => {\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\n};\n/**\n * Test if the given uri is a valid base64 data url\n * @param uri The uri to test\n * @return True if the uri is a base64 data url or false otherwise\n * @hidden\n */\nexport const IsBase64DataUrl = (uri: string): boolean => {\n return Base64DataUrlRegEx.test(uri);\n};\n/**\n * Decode the given base64 uri.\n * @param uri The uri to decode\n * @return The decoded base64 data.\n * @hidden\n */\nexport function DecodeBase64UrlToBinary(uri: string): ArrayBuffer {\n return DecodeBase64ToBinary(uri.split(\",\")[1]);\n}\n/**\n * Decode the given base64 uri into a UTF-8 encoded string.\n * @param uri The uri to decode\n * @return The decoded base64 data.\n * @hidden\n */\nexport const DecodeBase64UrlToString = (uri: string): string => {\n return DecodeBase64ToString(uri.split(\",\")[1]);\n};\n/**\n * This will be executed automatically for UMD and es5.\n * If esm dev wants the side effects to execute they will have to run it manually\n * Once we build native modules those need to be exported.\n * @hidden\n */\nconst initSideEffects = () => {\n ThinEngine._FileToolsLoadImage = LoadImage;\n ThinEngine._FileToolsLoadFile = LoadFile;\n ShaderProcessor._FileToolsLoadFile = LoadFile;\n};\ninitSideEffects();\n\n /**\n * FileTools defined as any.\n * This should not be imported or used in future releases or in any module in the framework\n * @hidden\n * @deprecated import the needed function from fileTools.ts\n */\nexport let FileTools: {\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer;\n DecodeBase64UrlToString: (uri: string) => string;\n DefaultRetryStrategy: any;\n BaseUrl: any;\n CorsBehavior: any;\n PreprocessUrl: any;\n IsBase64DataUrl: (uri: string) => boolean;\n IsFileURL: () => boolean;\n LoadFile: (fileOrUrl: string | File, onSuccess: (data: string | ArrayBuffer, responseURL?: string | undefined) => void, onProgress?: ((ev: ProgressEvent<EventTarget>) => void) | undefined, offlineProvider?: IOfflineProvider | undefined, useArrayBuffer?: boolean | undefined, onError?: ((request?: WebRequest | undefined, exception?: LoadFileError | undefined) => void) | undefined, onOpened?: ((request: WebRequest) => void) | undefined) => IFileRequest;\n LoadImage: (input: string | ArrayBuffer | Blob | ArrayBufferView, onLoad: (img: HTMLImageElement | ImageBitmap) => void, onError: (message?: string | undefined, exception?: any) => void, offlineProvider: Nullable<IOfflineProvider>, mimeType?: string | undefined, imageBitmapOptions?: ImageBitmapOptions | undefined) => Nullable<HTMLImageElement>;\n ReadFile: (file: File, onSuccess: (data: any) => void, onProgress?: ((ev: ProgressEvent<EventTarget>) => any) | undefined, useArrayBuffer?: boolean | undefined, onError?: ((error: ReadFileError) => void) | undefined) => IFileRequest;\n RequestFile: (url: string, onSuccess: (data: string | ArrayBuffer, request?: WebRequest | undefined) => void, onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined, offlineProvider?: IOfflineProvider | undefined, useArrayBuffer?: boolean | undefined, onError?: ((error: RequestFileError) => void) | undefined, onOpened?: ((request: WebRequest) => void) | undefined) => IFileRequest;\n SetCorsBehavior: (url: string | string[], element: {\n crossOrigin: string | null;\n }) => void;\n};\n/**\n * @param DecodeBase64UrlToBinary\n * @param DecodeBase64UrlToString\n * @param FileToolsOptions\n * @param FileToolsOptions.DefaultRetryStrategy\n * @param FileToolsOptions.BaseUrl\n * @param FileToolsOptions.CorsBehavior\n * @param FileToolsOptions.PreprocessUrl\n * @param IsBase64DataUrl\n * @param IsFileURL\n * @param LoadFile\n * @param LoadImage\n * @param ReadFile\n * @param RequestFile\n * @param SetCorsBehavior\n * @hidden\n */\nexport const _injectLTSFileTools = (DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer, DecodeBase64UrlToString: (uri: string) => string, FileToolsOptions: {\n DefaultRetryStrategy: any;\n BaseUrl: any;\n CorsBehavior: any;\n PreprocessUrl: any;\n}, IsBase64DataUrl: (uri: string) => boolean, IsFileURL: () => boolean, LoadFile: (fileOrUrl: string | File, onSuccess: (data: string | ArrayBuffer, responseURL?: string | undefined) => void, onProgress?: ((ev: ProgressEvent<EventTarget>) => void) | undefined, offlineProvider?: IOfflineProvider | undefined, useArrayBuffer?: boolean | undefined, onError?: ((request?: WebRequest | undefined, exception?: LoadFileError | undefined) => void) | undefined, onOpened?: ((request: WebRequest) => void) | undefined) => IFileRequest, LoadImage: (input: string | ArrayBuffer | ArrayBufferView | Blob, onLoad: (img: HTMLImageElement | ImageBitmap) => void, onError: (message?: string | undefined, exception?: any) => void, offlineProvider: Nullable<IOfflineProvider>, mimeType?: string, imageBitmapOptions?: ImageBitmapOptions | undefined) => Nullable<HTMLImageElement>, ReadFile: (file: File, onSuccess: (data: any) => void, onProgress?: ((ev: ProgressEvent<EventTarget>) => any) | undefined, useArrayBuffer?: boolean | undefined, onError?: ((error: ReadFileError) => void) | undefined) => IFileRequest, RequestFile: (url: string, onSuccess: (data: string | ArrayBuffer, request?: WebRequest | undefined) => void, onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined, offlineProvider?: IOfflineProvider | undefined, useArrayBuffer?: boolean | undefined, onError?: ((error: RequestFileError) => void) | undefined, onOpened?: ((request: WebRequest) => void) | undefined) => IFileRequest, SetCorsBehavior: (url: string | string[], element: {\n crossOrigin: string | null;\n}) => void) => {\n /**\n * Backwards compatibility.\n * @hidden\n * @deprecated\n */\n FileTools = {\n DecodeBase64UrlToBinary,\n DecodeBase64UrlToString,\n DefaultRetryStrategy: FileToolsOptions.DefaultRetryStrategy,\n BaseUrl: FileToolsOptions.BaseUrl,\n CorsBehavior: FileToolsOptions.CorsBehavior,\n PreprocessUrl: FileToolsOptions.PreprocessUrl,\n IsBase64DataUrl,\n IsFileURL,\n LoadFile,\n LoadImage,\n ReadFile,\n RequestFile,\n SetCorsBehavior\n };\n Object.defineProperty(FileTools, \"DefaultRetryStrategy\", {\n get: function (this: null) {\n return FileToolsOptions.DefaultRetryStrategy;\n },\n set: function (this: null, value: (url: string, request: WebRequest, retryIndex: number) => number) {\n FileToolsOptions.DefaultRetryStrategy = value;\n }\n });\n Object.defineProperty(FileTools, \"BaseUrl\", {\n get: function (this: null) {\n return FileToolsOptions.BaseUrl;\n },\n set: function (this: null, value: string) {\n FileToolsOptions.BaseUrl = value;\n }\n });\n Object.defineProperty(FileTools, \"PreprocessUrl\", {\n get: function (this: null) {\n return FileToolsOptions.PreprocessUrl;\n },\n set: function (this: null, value: (url: string) => string) {\n FileToolsOptions.PreprocessUrl = value;\n }\n });\n Object.defineProperty(FileTools, \"CorsBehavior\", {\n get: function (this: null) {\n return FileToolsOptions.CorsBehavior;\n },\n set: function (this: null, value: string | ((url: string | string[]) => string)) {\n FileToolsOptions.CorsBehavior = value;\n }\n });\n};\n_injectLTSFileTools(DecodeBase64UrlToBinary, DecodeBase64UrlToString, FileToolsOptions, IsBase64DataUrl, IsFileURL, LoadFile, LoadImage, ReadFile, RequestFile, SetCorsBehavior);\n"]}
|
|
1
|
+
{"version":3,"file":"fileTools.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/fileTools.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,gCAAgC,CAAC,CAAC;AACxE,cAAc;AACd,MAAM,OAAO,aAAc,SAAQ,YAAY;IAG3C;;;;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AgB,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3C,CAAC;KACJ,CAAC,CAAC;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE;QAC7C,GAAG,EAAE;YACD,OAAO,gBAAgB,CAAC,YAAY,CAAC;QACzC,CAAC;QACD,GAAG,EAAE,UAAsB,KAAoD;YAC3E,gBAAgB,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1C,CAAC;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AACF,mBAAmB,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { WebRequest } from \"./webRequest\";\nimport { IsWindowObjectExist } from \"./domManagement\";\nimport type { Nullable } from \"../types\";\nimport type { IOfflineProvider } from \"../Offline/IOfflineProvider\";\nimport type { IFileRequest } from \"./fileRequest\";\nimport { Observable } from \"./observable\";\nimport { FilesInputStore } from \"./filesInputStore\";\nimport { RetryStrategy } from \"./retryStrategy\";\nimport { BaseError, ErrorCodes, RuntimeError } from \"./error\";\nimport { DecodeBase64ToBinary, DecodeBase64ToString, EncodeArrayBufferToBase64 } from \"./stringTools\";\nimport { ShaderProcessor } from \"../Engines/Processors/shaderProcessor\";\nimport { ThinEngine } from \"../Engines/thinEngine\";\nimport { EngineStore } from \"../Engines/engineStore\";\nimport { Logger } from \"./logger\";\nimport { TimingTools } from \"./timingTools\";\nconst Base64DataUrlRegEx = new RegExp(/^data:([^,]+\\/[^,]+)?;base64,/i);\n/** @ignore */\nexport class LoadFileError extends RuntimeError {\n public request?: WebRequest;\n public file?: File;\n /**\n * Creates a new LoadFileError\n * @param message defines the message of the error\n * @param object defines the optional web request\n */\n constructor(message: string, object?: WebRequest | File) {\n super(message, ErrorCodes.LoadFileError);\n this.name = \"LoadFileError\";\n BaseError._setPrototypeOf(this, LoadFileError.prototype);\n if (object instanceof WebRequest) {\n this.request = object;\n }\n else {\n this.file = object;\n }\n }\n}\n/** @ignore */\nexport class RequestFileError extends RuntimeError {\n /**\n * Creates a new LoadFileError\n * @param message defines the message of the error\n * @param request defines the optional web request\n */\n constructor(message: string, public request: WebRequest) {\n super(message, ErrorCodes.RequestFileError);\n this.name = \"RequestFileError\";\n BaseError._setPrototypeOf(this, RequestFileError.prototype);\n }\n}\n/** @ignore */\nexport class ReadFileError extends RuntimeError {\n /**\n * Creates a new ReadFileError\n * @param message defines the message of the error\n * @param file defines the optional file\n */\n constructor(message: string, public file: File) {\n super(message, ErrorCodes.ReadFileError);\n this.name = \"ReadFileError\";\n BaseError._setPrototypeOf(this, ReadFileError.prototype);\n }\n}\n/**\n * @hidden\n */\nexport const FileToolsOptions: {\n DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;\n BaseUrl: string;\n CorsBehavior: string | ((url: string | string[]) => string);\n PreprocessUrl: (url: string) => string;\n} = {\n /**\n * Gets or sets the retry strategy to apply when an error happens while loading an asset.\n * When defining this function, return the wait time before trying again or return -1 to\n * stop retrying and error out.\n */\n DefaultRetryStrategy: RetryStrategy.ExponentialBackoff(),\n /**\n * Gets or sets the base URL to use to load assets\n */\n BaseUrl: \"\",\n /**\n * Default behaviour for cors in the application.\n * It can be a string if the expected behavior is identical in the entire app.\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\n */\n CorsBehavior: \"anonymous\",\n /**\n * Gets or sets a function used to pre-process url before using them to load assets\n * @param url\n */\n PreprocessUrl: (url: string) => {\n return url;\n }\n};\n/**\n * Removes unwanted characters from an url\n * @param url defines the url to clean\n * @returns the cleaned url\n */\nconst _CleanUrl = (url: string): string => {\n url = url.replace(/#/gm, \"%23\");\n return url;\n};\n/**\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\n * @param url define the url we are trying\n * @param element define the dom element where to configure the cors policy\n * @param element.crossOrigin\n * @hidden\n */\nexport const SetCorsBehavior = (url: string | string[], element: {\n crossOrigin: string | null;\n}): void => {\n if (url && url.indexOf(\"data:\") === 0) {\n return;\n }\n if (FileToolsOptions.CorsBehavior) {\n if (typeof FileToolsOptions.CorsBehavior === \"string\" || FileToolsOptions.CorsBehavior instanceof String) {\n element.crossOrigin = <string>FileToolsOptions.CorsBehavior;\n }\n else {\n const result = FileToolsOptions.CorsBehavior(url);\n if (result) {\n element.crossOrigin = result;\n }\n }\n }\n};\n/**\n * Loads an image as an HTMLImageElement.\n * @param input url string, ArrayBuffer, or Blob to load\n * @param onLoad callback called when the image successfully loads\n * @param onError callback called when the image fails to load\n * @param offlineProvider offline provider for caching\n * @param mimeType optional mime type\n * @param imageBitmapOptions\n * @returns the HTMLImageElement of the loaded image\n * @hidden\n */\nexport const LoadImage = (input: string | ArrayBuffer | ArrayBufferView | Blob, onLoad: (img: HTMLImageElement | ImageBitmap) => void, onError: (message?: string, exception?: any) => void, offlineProvider: Nullable<IOfflineProvider>, mimeType: string = \"\", imageBitmapOptions?: ImageBitmapOptions): Nullable<HTMLImageElement> => {\n let url: string;\n let usingObjectURL = false;\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\n if (typeof Blob !== \"undefined\" && typeof URL !== \"undefined\") {\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\n usingObjectURL = true;\n }\n else {\n url = `data:${mimeType};base64,` + EncodeArrayBufferToBase64(input);\n }\n }\n else if (input instanceof Blob) {\n url = URL.createObjectURL(input);\n usingObjectURL = true;\n }\n else {\n url = _CleanUrl(input);\n url = FileToolsOptions.PreprocessUrl(input);\n }\n const engine = EngineStore.LastCreatedEngine;\n const onErrorHandler = (exception: any) => {\n if (onError) {\n const inputText = url || input.toString();\n onError(`Error while trying to load image: ${inputText.indexOf(\"http\") === 0 || inputText.length <= 128 ? inputText : inputText.slice(0, 128) + \"...\"}`, exception);\n }\n };\n if (typeof Image === \"undefined\" || (engine?._features.forceBitmapOverHTMLImageElement ?? false)) {\n LoadFile(url, (data) => {\n engine!\n .createImageBitmap(new Blob([data], { type: mimeType }), { premultiplyAlpha: \"none\", ...imageBitmapOptions })\n .then((imgBmp) => {\n onLoad(imgBmp);\n if (usingObjectURL) {\n URL.revokeObjectURL(url);\n }\n })\n .catch((reason) => {\n if (onError) {\n onError(\"Error while trying to load image: \" + input, reason);\n }\n });\n }, undefined, offlineProvider || undefined, true, (request, exception) => {\n onErrorHandler(exception);\n });\n return null;\n }\n const img = new Image();\n SetCorsBehavior(url, img);\n const loadHandler = () => {\n img.removeEventListener(\"load\", loadHandler);\n img.removeEventListener(\"error\", errorHandler);\n onLoad(img);\n // Must revoke the URL after calling onLoad to avoid security exceptions in\n // certain scenarios (e.g. when hosted in vscode).\n if (usingObjectURL && img.src) {\n URL.revokeObjectURL(img.src);\n }\n };\n const errorHandler = (err: any) => {\n img.removeEventListener(\"load\", loadHandler);\n img.removeEventListener(\"error\", errorHandler);\n onErrorHandler(err);\n if (usingObjectURL && img.src) {\n URL.revokeObjectURL(img.src);\n }\n };\n img.addEventListener(\"load\", loadHandler);\n img.addEventListener(\"error\", errorHandler);\n const noOfflineSupport = () => {\n LoadFile(url, (data, _, contentType) => {\n const type = !mimeType && contentType ? contentType : mimeType;\n const blob = new Blob([data], { type });\n const url = URL.createObjectURL(blob);\n usingObjectURL = true;\n img.src = url;\n }, undefined, offlineProvider || undefined, true, (request, exception) => {\n onErrorHandler(exception);\n });\n };\n const loadFromOfflineSupport = () => {\n if (offlineProvider) {\n offlineProvider.loadImage(url, img);\n }\n };\n if (url.substr(0, 5) !== \"blob:\" && url.substr(0, 5) !== \"data:\" && offlineProvider && offlineProvider.enableTexturesOffline) {\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\n }\n else {\n if (url.indexOf(\"file:\") !== -1) {\n const textureName = decodeURIComponent(url.substring(5).toLowerCase());\n if (FilesInputStore.FilesToLoad[textureName] && typeof URL !== \"undefined\") {\n try {\n let blobURL;\n try {\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\n }\n catch (ex) {\n // Chrome doesn't support oneTimeOnly parameter\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\n }\n img.src = blobURL;\n usingObjectURL = true;\n }\n catch (e) {\n img.src = \"\";\n }\n return img;\n }\n }\n noOfflineSupport();\n }\n return img;\n};\n/**\n * Reads a file from a File object\n * @param file defines the file to load\n * @param onSuccess defines the callback to call when data is loaded\n * @param onProgress defines the callback to call during loading process\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\n * @param onError defines the callback to call when an error occurs\n * @returns a file request object\n * @hidden\n */\nexport const ReadFile = (file: File, onSuccess: (data: any) => void, onProgress?: (ev: ProgressEvent) => any, useArrayBuffer?: boolean, onError?: (error: ReadFileError) => void): IFileRequest => {\n const reader = new FileReader();\n const fileRequest: IFileRequest = {\n onCompleteObservable: new Observable<IFileRequest>(),\n abort: () => reader.abort()\n };\n reader.onloadend = () => fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n if (onError) {\n reader.onerror = () => {\n onError(new ReadFileError(`Unable to read ${file.name}`, file));\n };\n }\n reader.onload = (e) => {\n //target doesn't have result from ts 1.3\n onSuccess((<any>e.target)[\"result\"]);\n };\n if (onProgress) {\n reader.onprogress = onProgress;\n }\n if (!useArrayBuffer) {\n // Asynchronous read\n reader.readAsText(file);\n }\n else {\n reader.readAsArrayBuffer(file);\n }\n return fileRequest;\n};\n/**\n * Loads a file from a url, a data url, or a file url\n * @param fileOrUrl file, url, data url, or file url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @param onOpened\n * @returns a file request object\n * @hidden\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const LoadFile = (fileOrUrl: File | string, onSuccess: (data: string | ArrayBuffer, responseURL?: string, contentType?: Nullable<string>) => void, onProgress?: (ev: ProgressEvent) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void, onOpened?: (request: WebRequest) => void): IFileRequest => {\n if ((fileOrUrl as File).name) {\n return ReadFile(fileOrUrl as File, onSuccess, onProgress, useArrayBuffer, onError\n ? (error: ReadFileError) => {\n onError(undefined, error);\n }\n : undefined);\n }\n const url = fileOrUrl as string;\n // If file and file input are set\n if (url.indexOf(\"file:\") !== -1) {\n let fileName = decodeURIComponent(url.substring(5).toLowerCase());\n if (fileName.indexOf(\"./\") === 0) {\n fileName = fileName.substring(2);\n }\n const file = FilesInputStore.FilesToLoad[fileName];\n if (file) {\n return ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? (error) => onError(undefined, new LoadFileError(error.message, error.file)) : undefined);\n }\n }\n // For a Base64 Data URL\n const { match, type } = TestBase64DataUrl(url);\n if (match) {\n const fileRequest: IFileRequest = {\n onCompleteObservable: new Observable<IFileRequest>(),\n abort: () => () => { }\n };\n try {\n const data = useArrayBuffer ? DecodeBase64UrlToBinary(url) : DecodeBase64UrlToString(url);\n onSuccess(data, undefined, type);\n }\n catch (error) {\n if (onError) {\n onError(undefined, error);\n }\n else {\n Logger.Error(error.message || \"Failed to parse the Data URL\");\n }\n }\n TimingTools.SetImmediate(() => {\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n });\n return fileRequest;\n }\n return RequestFile(url, (data, request) => {\n onSuccess(data, request?.responseURL, request?.getResponseHeader(\"content-type\"));\n }, onProgress, offlineProvider, useArrayBuffer, onError\n ? (error) => {\n onError(error.request, new LoadFileError(error.message, error.request));\n }\n : undefined, onOpened);\n};\n/**\n * Loads a file from a url\n * @param url url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @param onOpened callback called when the web request is opened\n * @returns a file request object\n * @hidden\n */\nexport const RequestFile = (url: string, onSuccess?: (data: string | ArrayBuffer, request?: WebRequest) => void, onProgress?: (event: ProgressEvent) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (error: RequestFileError) => void, onOpened?: (request: WebRequest) => void): IFileRequest => {\n url = _CleanUrl(url);\n url = FileToolsOptions.PreprocessUrl(url);\n const loadUrl = FileToolsOptions.BaseUrl + url;\n let aborted = false;\n const fileRequest: IFileRequest = {\n onCompleteObservable: new Observable<IFileRequest>(),\n abort: () => (aborted = true)\n };\n const requestFile = () => {\n let request: Nullable<WebRequest> = new WebRequest();\n let retryHandle: Nullable<ReturnType<typeof setTimeout>> = null;\n let onReadyStateChange: Nullable<() => void>;\n const unbindEvents = () => {\n if (!request) {\n return;\n }\n if (onProgress) {\n request.removeEventListener(\"progress\", onProgress);\n }\n if (onReadyStateChange) {\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\n }\n request.removeEventListener(\"loadend\", onLoadEnd!);\n };\n let onLoadEnd: Nullable<() => void> = () => {\n unbindEvents();\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n fileRequest.onCompleteObservable.clear();\n onProgress = undefined;\n onReadyStateChange = null;\n onLoadEnd = null;\n onError = undefined;\n onOpened = undefined;\n onSuccess = undefined;\n };\n fileRequest.abort = () => {\n aborted = true;\n if (onLoadEnd) {\n onLoadEnd();\n }\n if (request && request.readyState !== (XMLHttpRequest.DONE || 4)) {\n request.abort();\n }\n if (retryHandle !== null) {\n clearTimeout(retryHandle);\n retryHandle = null;\n }\n request = null;\n };\n const handleError = (error: any) => {\n const message = error.message || \"Unknown error\";\n if (onError && request) {\n onError(new RequestFileError(message, request));\n }\n else {\n Logger.Error(message);\n }\n };\n const retryLoop = (retryIndex: number) => {\n if (!request) {\n return;\n }\n request.open(\"GET\", loadUrl);\n if (onOpened) {\n try {\n onOpened(request);\n }\n catch (e) {\n handleError(e);\n return;\n }\n }\n if (useArrayBuffer) {\n request.responseType = \"arraybuffer\";\n }\n if (onProgress) {\n request.addEventListener(\"progress\", onProgress);\n }\n if (onLoadEnd) {\n request.addEventListener(\"loadend\", onLoadEnd);\n }\n onReadyStateChange = () => {\n if (aborted || !request) {\n return;\n }\n // In case of undefined state in some browsers.\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\n if (onReadyStateChange) {\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\n }\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!IsWindowObjectExist() || IsFileURL()))) {\n try {\n if (onSuccess) {\n onSuccess(useArrayBuffer ? request.response : request.responseText, request);\n }\n }\n catch (e) {\n handleError(e);\n }\n return;\n }\n const retryStrategy = FileToolsOptions.DefaultRetryStrategy;\n if (retryStrategy) {\n const waitTime = retryStrategy(loadUrl, request, retryIndex);\n if (waitTime !== -1) {\n // Prevent the request from completing for retry.\n unbindEvents();\n request = new WebRequest();\n retryHandle = setTimeout(() => retryLoop(retryIndex + 1), waitTime);\n return;\n }\n }\n const error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\n if (onError) {\n onError(error);\n }\n }\n };\n request.addEventListener(\"readystatechange\", onReadyStateChange);\n request.send();\n };\n retryLoop(0);\n };\n // Caching all files\n if (offlineProvider && offlineProvider.enableSceneOffline) {\n const noOfflineSupport = (request?: any) => {\n if (request && request.status > 400) {\n if (onError) {\n onError(request);\n }\n }\n else {\n requestFile();\n }\n };\n const loadFromOfflineSupport = () => {\n // TODO: database needs to support aborting and should return a IFileRequest\n if (offlineProvider) {\n offlineProvider.loadFile(FileToolsOptions.BaseUrl + url, (data) => {\n if (!aborted && onSuccess) {\n onSuccess(data);\n }\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n }, onProgress\n ? (event) => {\n if (!aborted && onProgress) {\n onProgress(event);\n }\n }\n : undefined, noOfflineSupport, useArrayBuffer);\n }\n };\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\n }\n else {\n requestFile();\n }\n return fileRequest;\n};\n/**\n * Checks if the loaded document was accessed via `file:`-Protocol.\n * @returns boolean\n * @hidden\n */\nexport const IsFileURL = (): boolean => {\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\n};\n/**\n * Test if the given uri is a valid base64 data url\n * @param uri The uri to test\n * @return True if the uri is a base64 data url or false otherwise\n * @hidden\n */\nexport const IsBase64DataUrl = (uri: string): boolean => {\n return Base64DataUrlRegEx.test(uri);\n};\nexport const TestBase64DataUrl = (uri: string): {\n match: boolean;\n type: string;\n} => {\n const results = Base64DataUrlRegEx.exec(uri);\n if (results === null || results.length === 0) {\n return { match: false, type: \"\" };\n }\n else {\n const type = results[0].replace(\"data:\", \"\").replace(\"base64,\", \"\");\n return { match: true, type };\n }\n};\n/**\n * Decode the given base64 uri.\n * @param uri The uri to decode\n * @return The decoded base64 data.\n * @hidden\n */\nexport function DecodeBase64UrlToBinary(uri: string): ArrayBuffer {\n return DecodeBase64ToBinary(uri.split(\",\")[1]);\n}\n/**\n * Decode the given base64 uri into a UTF-8 encoded string.\n * @param uri The uri to decode\n * @return The decoded base64 data.\n * @hidden\n */\nexport const DecodeBase64UrlToString = (uri: string): string => {\n return DecodeBase64ToString(uri.split(\",\")[1]);\n};\n/**\n * This will be executed automatically for UMD and es5.\n * If esm dev wants the side effects to execute they will have to run it manually\n * Once we build native modules those need to be exported.\n * @hidden\n */\nconst initSideEffects = () => {\n ThinEngine._FileToolsLoadImage = LoadImage;\n ThinEngine._FileToolsLoadFile = LoadFile;\n ShaderProcessor._FileToolsLoadFile = LoadFile;\n};\ninitSideEffects();\n\n /**\n * FileTools defined as any.\n * This should not be imported or used in future releases or in any module in the framework\n * @hidden\n * @deprecated import the needed function from fileTools.ts\n */\nexport let FileTools: {\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer;\n DecodeBase64UrlToString: (uri: string) => string;\n DefaultRetryStrategy: any;\n BaseUrl: any;\n CorsBehavior: any;\n PreprocessUrl: any;\n IsBase64DataUrl: (uri: string) => boolean;\n IsFileURL: () => boolean;\n LoadFile: (fileOrUrl: string | File, onSuccess: (data: string | ArrayBuffer, responseURL?: string | undefined) => void, onProgress?: ((ev: ProgressEvent<EventTarget>) => void) | undefined, offlineProvider?: IOfflineProvider | undefined, useArrayBuffer?: boolean | undefined, onError?: ((request?: WebRequest | undefined, exception?: LoadFileError | undefined) => void) | undefined, onOpened?: ((request: WebRequest) => void) | undefined) => IFileRequest;\n LoadImage: (input: string | ArrayBuffer | Blob | ArrayBufferView, onLoad: (img: HTMLImageElement | ImageBitmap) => void, onError: (message?: string | undefined, exception?: any) => void, offlineProvider: Nullable<IOfflineProvider>, mimeType?: string | undefined, imageBitmapOptions?: ImageBitmapOptions | undefined) => Nullable<HTMLImageElement>;\n ReadFile: (file: File, onSuccess: (data: any) => void, onProgress?: ((ev: ProgressEvent<EventTarget>) => any) | undefined, useArrayBuffer?: boolean | undefined, onError?: ((error: ReadFileError) => void) | undefined) => IFileRequest;\n RequestFile: (url: string, onSuccess: (data: string | ArrayBuffer, request?: WebRequest | undefined) => void, onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined, offlineProvider?: IOfflineProvider | undefined, useArrayBuffer?: boolean | undefined, onError?: ((error: RequestFileError) => void) | undefined, onOpened?: ((request: WebRequest) => void) | undefined) => IFileRequest;\n SetCorsBehavior: (url: string | string[], element: {\n crossOrigin: string | null;\n }) => void;\n};\n/**\n * @param DecodeBase64UrlToBinary\n * @param DecodeBase64UrlToString\n * @param FileToolsOptions\n * @param FileToolsOptions.DefaultRetryStrategy\n * @param FileToolsOptions.BaseUrl\n * @param FileToolsOptions.CorsBehavior\n * @param FileToolsOptions.PreprocessUrl\n * @param IsBase64DataUrl\n * @param IsFileURL\n * @param LoadFile\n * @param LoadImage\n * @param ReadFile\n * @param RequestFile\n * @param SetCorsBehavior\n * @hidden\n */\nexport const _injectLTSFileTools = (DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer, DecodeBase64UrlToString: (uri: string) => string, FileToolsOptions: {\n DefaultRetryStrategy: any;\n BaseUrl: any;\n CorsBehavior: any;\n PreprocessUrl: any;\n}, IsBase64DataUrl: (uri: string) => boolean, IsFileURL: () => boolean, LoadFile: (fileOrUrl: string | File, onSuccess: (data: string | ArrayBuffer, responseURL?: string | undefined) => void, onProgress?: ((ev: ProgressEvent<EventTarget>) => void) | undefined, offlineProvider?: IOfflineProvider | undefined, useArrayBuffer?: boolean | undefined, onError?: ((request?: WebRequest | undefined, exception?: LoadFileError | undefined) => void) | undefined, onOpened?: ((request: WebRequest) => void) | undefined) => IFileRequest, LoadImage: (input: string | ArrayBuffer | ArrayBufferView | Blob, onLoad: (img: HTMLImageElement | ImageBitmap) => void, onError: (message?: string | undefined, exception?: any) => void, offlineProvider: Nullable<IOfflineProvider>, mimeType?: string, imageBitmapOptions?: ImageBitmapOptions | undefined) => Nullable<HTMLImageElement>, ReadFile: (file: File, onSuccess: (data: any) => void, onProgress?: ((ev: ProgressEvent<EventTarget>) => any) | undefined, useArrayBuffer?: boolean | undefined, onError?: ((error: ReadFileError) => void) | undefined) => IFileRequest, RequestFile: (url: string, onSuccess: (data: string | ArrayBuffer, request?: WebRequest | undefined) => void, onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined, offlineProvider?: IOfflineProvider | undefined, useArrayBuffer?: boolean | undefined, onError?: ((error: RequestFileError) => void) | undefined, onOpened?: ((request: WebRequest) => void) | undefined) => IFileRequest, SetCorsBehavior: (url: string | string[], element: {\n crossOrigin: string | null;\n}) => void) => {\n /**\n * Backwards compatibility.\n * @hidden\n * @deprecated\n */\n FileTools = {\n DecodeBase64UrlToBinary,\n DecodeBase64UrlToString,\n DefaultRetryStrategy: FileToolsOptions.DefaultRetryStrategy,\n BaseUrl: FileToolsOptions.BaseUrl,\n CorsBehavior: FileToolsOptions.CorsBehavior,\n PreprocessUrl: FileToolsOptions.PreprocessUrl,\n IsBase64DataUrl,\n IsFileURL,\n LoadFile,\n LoadImage,\n ReadFile,\n RequestFile,\n SetCorsBehavior\n };\n Object.defineProperty(FileTools, \"DefaultRetryStrategy\", {\n get: function (this: null) {\n return FileToolsOptions.DefaultRetryStrategy;\n },\n set: function (this: null, value: (url: string, request: WebRequest, retryIndex: number) => number) {\n FileToolsOptions.DefaultRetryStrategy = value;\n }\n });\n Object.defineProperty(FileTools, \"BaseUrl\", {\n get: function (this: null) {\n return FileToolsOptions.BaseUrl;\n },\n set: function (this: null, value: string) {\n FileToolsOptions.BaseUrl = value;\n }\n });\n Object.defineProperty(FileTools, \"PreprocessUrl\", {\n get: function (this: null) {\n return FileToolsOptions.PreprocessUrl;\n },\n set: function (this: null, value: (url: string) => string) {\n FileToolsOptions.PreprocessUrl = value;\n }\n });\n Object.defineProperty(FileTools, \"CorsBehavior\", {\n get: function (this: null) {\n return FileToolsOptions.CorsBehavior;\n },\n set: function (this: null, value: string | ((url: string | string[]) => string)) {\n FileToolsOptions.CorsBehavior = value;\n }\n });\n};\n_injectLTSFileTools(DecodeBase64UrlToBinary, DecodeBase64UrlToString, FileToolsOptions, IsBase64DataUrl, IsFileURL, LoadFile, LoadImage, ReadFile, RequestFile, SetCorsBehavior);\n"]}
|
package/Misc/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./filesInput";
|
|
|
10
10
|
export * from "./HighDynamicRange/index";
|
|
11
11
|
export * from "./khronosTextureContainer";
|
|
12
12
|
export * from "./observable";
|
|
13
|
+
export * from "./observable.extensions";
|
|
13
14
|
export * from "./performanceMonitor";
|
|
14
15
|
export * from "./sceneOptimizer";
|
|
15
16
|
export * from "./sceneSerializer";
|
package/Misc/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./filesInput.js";
|
|
|
11
11
|
export * from "./HighDynamicRange/index.js";
|
|
12
12
|
export * from "./khronosTextureContainer.js";
|
|
13
13
|
export * from "./observable.js";
|
|
14
|
+
export * from "./observable.extensions.js";
|
|
14
15
|
export * from "./performanceMonitor.js";
|
|
15
16
|
export * from "./sceneOptimizer.js";
|
|
16
17
|
export * from "./sceneSerializer.js";
|
package/Misc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,yCAAyC;AACzC,cAAc,uBAAuB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./computePressure\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,c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,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,yCAAyC;AACzC,cAAc,uBAAuB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./computePressure\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\n"]}
|
package/Misc/logger.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare class Logger {
|
|
|
29
29
|
static MessageLimitReached: string;
|
|
30
30
|
private static _LogCache;
|
|
31
31
|
private static _LogLimitOutputs;
|
|
32
|
+
private static _Levels;
|
|
32
33
|
/**
|
|
33
34
|
* Gets a value indicating the number of loading errors
|
|
34
35
|
* @ignorenaming
|
|
@@ -44,10 +45,6 @@ export declare class Logger {
|
|
|
44
45
|
private static _FormatMessage;
|
|
45
46
|
private static _LogDisabled;
|
|
46
47
|
private static _LogEnabled;
|
|
47
|
-
private static _WarnDisabled;
|
|
48
|
-
private static _WarnEnabled;
|
|
49
|
-
private static _ErrorDisabled;
|
|
50
|
-
private static _ErrorEnabled;
|
|
51
48
|
/**
|
|
52
49
|
* Log a message to the console
|
|
53
50
|
*/
|
package/Misc/logger.js
CHANGED
|
@@ -14,23 +14,14 @@ export class Logger {
|
|
|
14
14
|
}
|
|
15
15
|
return entry.current <= entry.limit;
|
|
16
16
|
}
|
|
17
|
-
static _GenerateLimitMessage(message,
|
|
17
|
+
static _GenerateLimitMessage(message, level = 1) {
|
|
18
18
|
const entry = Logger._LogLimitOutputs[message];
|
|
19
19
|
if (!entry || !Logger.MessageLimitReached) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
+
const type = this._Levels[level];
|
|
22
23
|
if (entry.current === entry.limit) {
|
|
23
|
-
|
|
24
|
-
case 0:
|
|
25
|
-
Logger.Log(Logger.MessageLimitReached.replace(/%LIMIT%/g, "" + entry.limit).replace(/%TYPE%/g, "log"));
|
|
26
|
-
break;
|
|
27
|
-
case 1:
|
|
28
|
-
Logger.Warn(Logger.MessageLimitReached.replace(/%LIMIT%/g, "" + entry.limit).replace(/%TYPE%/g, "warning"));
|
|
29
|
-
break;
|
|
30
|
-
case 2:
|
|
31
|
-
Logger.Error(Logger.MessageLimitReached.replace(/%LIMIT%/g, "" + entry.limit).replace(/%TYPE%/g, "error"));
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
24
|
+
Logger.Log(Logger.MessageLimitReached.replace(/%LIMIT%/g, "" + entry.limit).replace(/%TYPE%/g, type.name ?? ""));
|
|
34
25
|
}
|
|
35
26
|
}
|
|
36
27
|
static _AddLogEntry(entry) {
|
|
@@ -48,44 +39,16 @@ export class Logger {
|
|
|
48
39
|
static _LogDisabled(message, limit) {
|
|
49
40
|
// nothing to do
|
|
50
41
|
}
|
|
51
|
-
static _LogEnabled(message, limit) {
|
|
42
|
+
static _LogEnabled(level = 1, message, limit) {
|
|
52
43
|
if (limit !== undefined && !Logger._CheckLimit(message, limit)) {
|
|
53
44
|
return;
|
|
54
45
|
}
|
|
55
46
|
const formattedMessage = Logger._FormatMessage(message);
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
const type = this._Levels[level];
|
|
48
|
+
type.logFunc && type.logFunc("BJS - " + formattedMessage);
|
|
49
|
+
const entry = `<div style='color:${type.color}'>${formattedMessage}</div><br>`;
|
|
58
50
|
Logger._AddLogEntry(entry);
|
|
59
|
-
Logger._GenerateLimitMessage(message,
|
|
60
|
-
}
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
62
|
-
static _WarnDisabled(message, limit) {
|
|
63
|
-
// nothing to do
|
|
64
|
-
}
|
|
65
|
-
static _WarnEnabled(message, limit) {
|
|
66
|
-
if (limit !== undefined && !Logger._CheckLimit(message, limit)) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const formattedMessage = Logger._FormatMessage(message);
|
|
70
|
-
console.warn("BJS - " + formattedMessage);
|
|
71
|
-
const entry = "<div style='color:orange'>" + message + "</div><br>";
|
|
72
|
-
Logger._AddLogEntry(entry);
|
|
73
|
-
Logger._GenerateLimitMessage(message, 1);
|
|
74
|
-
}
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
76
|
-
static _ErrorDisabled(message, limit) {
|
|
77
|
-
// nothing to do
|
|
78
|
-
}
|
|
79
|
-
static _ErrorEnabled(message, limit) {
|
|
80
|
-
if (limit !== undefined && !Logger._CheckLimit(message, limit)) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const formattedMessage = Logger._FormatMessage(message);
|
|
84
|
-
Logger.errorsCount++;
|
|
85
|
-
console.error("BJS - " + formattedMessage);
|
|
86
|
-
const entry = "<div style='color:red'>" + formattedMessage + "</div><br>";
|
|
87
|
-
Logger._AddLogEntry(entry);
|
|
88
|
-
Logger._GenerateLimitMessage(message, 2);
|
|
51
|
+
Logger._GenerateLimitMessage(message, level);
|
|
89
52
|
}
|
|
90
53
|
/**
|
|
91
54
|
* Gets current log cache (list of logs)
|
|
@@ -105,24 +68,15 @@ export class Logger {
|
|
|
105
68
|
* Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)
|
|
106
69
|
*/
|
|
107
70
|
static set LogLevels(level) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
Logger.Warn = Logger._WarnDisabled;
|
|
119
|
-
}
|
|
120
|
-
if ((level & Logger.ErrorLogLevel) === Logger.ErrorLogLevel) {
|
|
121
|
-
Logger.Error = Logger._ErrorEnabled;
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
Logger.Error = Logger._ErrorDisabled;
|
|
125
|
-
}
|
|
71
|
+
Logger.Log = Logger._LogDisabled;
|
|
72
|
+
Logger.Warn = Logger._LogDisabled;
|
|
73
|
+
Logger.Error = Logger._LogDisabled;
|
|
74
|
+
[Logger.MessageLogLevel, Logger.WarningLogLevel, Logger.ErrorLogLevel].forEach((l) => {
|
|
75
|
+
if ((level & l) === l) {
|
|
76
|
+
const type = this._Levels[l];
|
|
77
|
+
Logger[type.name] = Logger._LogEnabled.bind(Logger, l);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
126
80
|
}
|
|
127
81
|
}
|
|
128
82
|
/**
|
|
@@ -151,6 +105,14 @@ Logger.AllLogLevel = 7;
|
|
|
151
105
|
Logger.MessageLimitReached = "Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.";
|
|
152
106
|
Logger._LogCache = "";
|
|
153
107
|
Logger._LogLimitOutputs = {};
|
|
108
|
+
// levels according to the (binary) numbering.
|
|
109
|
+
Logger._Levels = [
|
|
110
|
+
{},
|
|
111
|
+
{ color: "white", logFunc: console.log, name: "Log" },
|
|
112
|
+
{ color: "orange", logFunc: console.warn, name: "Warn" },
|
|
113
|
+
{},
|
|
114
|
+
{ color: "red", logFunc: console.error, name: "Error" },
|
|
115
|
+
];
|
|
154
116
|
/**
|
|
155
117
|
* Gets a value indicating the number of loading errors
|
|
156
118
|
* @ignorenaming
|
|
@@ -160,13 +122,13 @@ Logger.errorsCount = 0;
|
|
|
160
122
|
/**
|
|
161
123
|
* Log a message to the console
|
|
162
124
|
*/
|
|
163
|
-
Logger.Log = Logger._LogEnabled;
|
|
125
|
+
Logger.Log = Logger._LogEnabled.bind(Logger, Logger.MessageLogLevel);
|
|
164
126
|
/**
|
|
165
127
|
* Write a warning message to the console
|
|
166
128
|
*/
|
|
167
|
-
Logger.Warn = Logger.
|
|
129
|
+
Logger.Warn = Logger._LogEnabled.bind(Logger, Logger.WarningLogLevel);
|
|
168
130
|
/**
|
|
169
131
|
* Write an error message to the console
|
|
170
132
|
*/
|
|
171
|
-
Logger.Error = Logger.
|
|
133
|
+
Logger.Error = Logger._LogEnabled.bind(Logger, Logger.ErrorLogLevel);
|
|
172
134
|
//# sourceMappingURL=logger.js.map
|