Class Tools
Hierarchy
- Tools
Index
Constructors
Properties
Accessors
Methods
- Back
Compat Camera No Prevent Default - Clean
Url - Clear
Log Cache - Create
Screenshot - Create
Screenshot Async - Create
Screenshot Using Render Target - Create
Screenshot Using Render Target Async - Decode
Base64 - Deep
Copy - Delay
Async - Download
- Download
Blob - Dump
Data - Dump
Data Async - Dump
Framebuffer - Encode
Screenshot Canvas Data - Error
- Fetch
To Ref - File
AsURL - First
- Float
Round - Format
- Get
Class Name - Get
Filename - Get
Folder Path - Get
Pointer Prefix - Instantiate
- Is
Base64 - Is
Empty - Is
Exponent Of Two - Is
Safari - Load
File - Load
File Async - Load
Image - Load
Script - Load
Script Async - Log
- Make
Array - Mix
- Random
Id - Read
File - Read
File As DataURL - Register
Top Root Events - Set
Cors Behavior - Set
Immediate - Set
Referrer Policy Behavior - Smooth
Angle Change - To
Blob - To
Degrees - To
Radians - Unregister
Top Root Events - Warn
- get
Full Class Name
Constructors
constructor
Returns Tools
Properties
Static Readonly All Log LevelSearch playground for AllLogLevel
All logs
Static Custom Request HeadersSearch playground for CustomRequestHeaders
Custom HTTP Request Headers to be sent with XMLHttpRequests i.e. when loading files, where the server/service expects an Authorization header
Type declaration
[key: string]: string
Static End Performance CounterSearch playground for EndPerformanceCounter
Type declaration
Ends a specific performance counter
Parameters
counterName: string
Optional condition: boolean
Returns void
Static Readonly Error Log LevelSearch playground for ErrorLogLevel
Only error logs
Static Get Absolute UrlSearch playground for GetAbsoluteUrl
Type declaration
Parameters
url: string
Returns string
Static GetDOMText ContentSearch playground for GetDOMTextContent
Type declaration
Extracts text content from a DOM element hierarchy
Parameters
element: HTMLElement
defines the root element
Returns string
a string
Static Is Window Object ExistSearch playground for IsWindowObjectExist
Type declaration
Checks if the window object exists
Returns boolean
true if the window object exists
Static Readonly Message Log LevelSearch playground for MessageLogLevel
Only message logs
Static Readonly None Log LevelSearch playground for NoneLogLevel
No log
Static On New Cache EntrySearch playground for OnNewCacheEntry
Type declaration
Callback called when a new log is added
Parameters
entry: string
Returns void
Static Readonly Performance Console Log LevelSearch playground for PerformanceConsoleLogLevel
Log performance to the console
Static Readonly Performance None Log LevelSearch playground for PerformanceNoneLogLevel
No performance log
Static Readonly Performance User Mark Log LevelSearch playground for PerformanceUserMarkLogLevel
Use user marks to log performance
Static Start Performance CounterSearch playground for StartPerformanceCounter
Type declaration
Starts a performance counter
Parameters
counterName: string
Optional condition: boolean
Returns void
Static Use Custom Request HeadersSearch playground for UseCustomRequestHeaders
Enable/Disable Custom HTTP Request Headers globally. default = false
Static Readonly Warning Log LevelSearch playground for WarningLogLevel
Only warning logs
Accessors
Static Base Url
Gets or sets the base URL to use to load assets
Returns string
Gets or sets the base URL to use to load assets
Parameters
value: string
Returns void
Static Cors Behavior
Default behaviour for cors in the application. It can be a string if the expected behavior is identical in the entire app. Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)
Returns string | ((url: string | string[]) => string)
Default behaviour for cors in the application. It can be a string if the expected behavior is identical in the entire app. Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)
Parameters
value: string | ((url: string | string[]) => string)
Returns void
Static Default Retry Strategy
Gets or sets the retry strategy to apply when an error happens while loading an asset
Returns ((url: string, request: WebRequest, retryIndex: number) => number)
Gets or sets the retry strategy to apply when an error happens while loading an asset
Parameters
url: string
request: WebRequest
retryIndex: number
Returns number
Gets or sets the retry strategy to apply when an error happens while loading an asset
Parameters
strategy: ((url: string, request: WebRequest, retryIndex: number) => number)
Parameters
url: string
request: WebRequest
retryIndex: number
Returns number
Returns void
Static Log Cache
Gets current log cache (list of logs)
Returns string
Static Log Levels
Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)
Parameters
level: number
Returns void
Static Now
Gets either window.performance.now() if supported or Date.now() else
Returns number
Static Performance Log Level
Sets the current performance log level
Parameters
level: number
Returns void
Static Preprocess Url
Gets or sets a function used to pre-process url before using them to load assets
Returns ((url: string) => string)
Gets or sets a function used to pre-process url before using them to load assets
Parameters
url: string
Returns string
Gets or sets a function used to pre-process url before using them to load assets
Parameters
processor: ((url: string) => string)
Parameters
url: string
Returns string
Returns void
Static Registered External Classes
Use this object to register external classes like custom textures or material to allow the loaders to instantiate them
Returns {}
[key: string]: Object
Use this object to register external classes like custom textures or material to allow the loaders to instantiate them
Parameters
classes: {}
[key: string]: Object
Returns void
Static Use Fallback Texture
Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded
Returns boolean
Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded
Parameters
value: boolean
Returns void
Static errors Count
Gets a value indicating the number of loading errors
Returns number
Static fallback Texture
Texture content used if a texture cannot loaded
Returns string
Texture content used if a texture cannot loaded
Parameters
value: string
Returns void
Methods
Static Back Compat Camera No Prevent DefaultSearch playground for BackCompatCameraNoPreventDefault
Will return the right value of the noPreventDefault variable Needed to keep backwards compatibility to the old API.
Parameters
args: IArguments
arguments passed to the attachControl function
Returns boolean
the correct value for noPreventDefault
Static Clean UrlSearch playground for CleanUrl
Removes unwanted characters from an url
Parameters
url: string
defines the url to clean
Returns string
the cleaned url
Static Clear Log CacheSearch playground for ClearLogCache
Clears the log cache
Returns void
Static Create ScreenshotSearch playground for CreateScreenshot
Captures a screenshot of the current rendering
Parameters
engine: Engine
defines the rendering engine
camera: Camera
defines the source camera
size: number | IScreenshotSize
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Optional successCallback: ((data: string) => void)
defines the callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an
to display it
Parameters
data: string
Returns void
Optional mimeType: string
defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Optional forceDownload: boolean
force the system to download the image even if a successCallback is provided
Optional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter.
Returns void
Static Create Screenshot AsyncSearch playground for CreateScreenshotAsync
Captures a screenshot of the current rendering
Parameters
engine: Engine
defines the rendering engine
camera: Camera
defines the source camera
size: number | IScreenshotSize
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Optional mimeType: string
defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Optional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter.
Returns Promise<string>
screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an
to display it
Static Create Screenshot Using Render TargetSearch playground for CreateScreenshotUsingRenderTarget
Generates an image screenshot from the specified camera.
Parameters
engine: Engine
The engine to use for rendering
camera: Camera
The camera to use for rendering
size: number | IScreenshotSize
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Optional successCallback: ((data: string) => void)
The callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an
to display it
Parameters
data: string
Returns void
Optional mimeType: string
The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Optional samples: number
Texture samples (default: 1)
Optional antialiasing: boolean
Whether antialiasing should be turned on or not (default: false)
Optional fileName: string
A name for for the downloaded file.
Optional renderSprites: boolean
Whether the sprites should be rendered or not (default: false)
Optional enableStencilBuffer: boolean
Whether the stencil buffer should be enabled or not (default: false)
Optional useLayerMask: boolean
if the camera's layer mask should be used to filter what should be rendered (default: true)
Optional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter.
Returns void
Static Create Screenshot Using Render Target AsyncSearch playground for CreateScreenshotUsingRenderTargetAsync
Generates an image screenshot from the specified camera.
Parameters
engine: Engine
The engine to use for rendering
camera: Camera
The camera to use for rendering
size: number | IScreenshotSize
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Optional mimeType: string
The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Optional samples: number
Texture samples (default: 1)
Optional antialiasing: boolean
Whether antialiasing should be turned on or not (default: false)
Optional fileName: string
A name for for the downloaded file.
Optional renderSprites: boolean
Whether the sprites should be rendered or not (default: false)
Optional enableStencilBuffer: boolean
Whether the stencil buffer should be enabled or not (default: false)
Optional useLayerMask: boolean
if the camera's layer mask should be used to filter what should be rendered (default: true)
Optional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter. to the src parameter of anto display it
Returns Promise<string>
screenshot as a string of base64-encoded characters. This string can be assigned
Static Decode Base64Search playground for DecodeBase64
Decode the given base64 uri.
Parameters
uri: string
The uri to decode
Returns ArrayBuffer
The decoded base64 data.
Static Deep CopySearch playground for DeepCopy
Tries to copy an object by duplicating every property
Parameters
source: any
defines the source object
destination: any
defines the target object
Optional doNotCopyList: string[]
defines a list of properties to avoid
Optional mustCopyList: string[]
defines a list of properties to copy (even if they start with _)
Returns void
Static Delay AsyncSearch playground for DelayAsync
Returns a promise that resolves after the given amount of time.
Parameters
delay: number
Number of milliseconds to delay
Returns Promise<void>
Promise that resolves after the given amount of time
Static DownloadSearch playground for Download
Downloads a blob in the browser
Parameters
blob: Blob
defines the blob to download
fileName: string
defines the name of the downloaded file
Returns void
Static Download BlobSearch playground for DownloadBlob
Download a Blob object
Parameters
blob: Blob
the Blob object
Optional fileName: string
the file name to download
Returns void
Static Dump DataSearch playground for DumpData
Dumps an array buffer
Parameters
width: number
defines the rendering width
height: number
defines the rendering height
data: ArrayBufferView
the data array
Optional successCallback: ((data: string | ArrayBuffer) => void)
defines the callback triggered once the data are available
Parameters
data: string | ArrayBuffer
Returns void
Optional mimeType: string
defines the mime type of the result
Optional fileName: string
defines the filename to download. If present, the result will automatically be downloaded
Optional invertY: boolean
true to invert the picture in the Y dimension
Optional toArrayBuffer: boolean
true to convert the data to an ArrayBuffer (encoded as
mimeType
) instead of a base64 stringOptional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter.
Returns void
Static Dump Data AsyncSearch playground for DumpDataAsync
Dumps an array buffer
Parameters
width: number
defines the rendering width
height: number
defines the rendering height
data: ArrayBufferView
the data array
Optional mimeType: string
defines the mime type of the result
Optional fileName: string
defines the filename to download. If present, the result will automatically be downloaded
Optional invertY: boolean
true to invert the picture in the Y dimension
Optional toArrayBuffer: boolean
true to convert the data to an ArrayBuffer (encoded as
mimeType
) instead of a base64 stringOptional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter.
Returns Promise<string | ArrayBuffer>
a promise that resolve to the final data
Static Dump FramebufferSearch playground for DumpFramebuffer
Dumps the current bound framebuffer
Parameters
width: number
defines the rendering width
height: number
defines the rendering height
engine: Engine
defines the hosting engine
Optional successCallback: ((data: string) => void)
defines the callback triggered once the data are available
Parameters
data: string
Returns void
Optional mimeType: string
defines the mime type of the result
Optional fileName: string
defines the filename to download. If present, the result will automatically be downloaded
Optional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter.
Returns Promise<void>
a void promise
Static Encode Screenshot Canvas DataSearch playground for EncodeScreenshotCanvasData
Encodes the canvas data to base 64, or automatically downloads the result if
fileName
is defined.Parameters
canvas: HTMLCanvasElement | OffscreenCanvas
The canvas to get the data from, which can be an offscreen canvas.
Optional successCallback: ((data: string) => void)
The callback which is triggered once the data is available. If
fileName
is defined, the callback will be invoked after the download occurs, and thedata
argument will be an empty string.Parameters
data: string
Returns void
Optional mimeType: string
The mime type of the result.
Optional fileName: string
The name of the file to download. If defined, the result will automatically be downloaded. If not defined, and
successCallback
is also not defined, the result will automatically be downloaded with an auto-generated file name.Optional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter.
Returns void
Static ErrorSearch playground for Error
Write an error message to the console
Parameters
message: string
defines the message to log
Returns void
Static Fetch To RefSearch playground for FetchToRef
Read the content of a byte array at a specified coordinates (taking in account wrapping)
Parameters
u: number
defines the coordinate on X axis
v: number
defines the coordinate on Y axis
width: number
defines the width of the source data
height: number
defines the height of the source data
pixels: Uint8Array
defines the source byte array
color: IColor4Like
defines the output color
Returns void
Static File AsURLSearch playground for FileAsURL
Creates a data url from a given string content
Parameters
content: string
defines the content to convert
Returns string
the new data url link
Static FirstSearch playground for First
Gets the first element of an array satisfying a given predicate
Type Parameters
T
Parameters
array: T[]
defines the array to browse
predicate: ((item: T) => boolean)
defines the predicate to use
Parameters
item: T
Returns boolean
Returns Nullable<T>
null if not found or the element
Static Float RoundSearch playground for FloatRound
Returns the nearest 32-bit single precision float representation of a Number
Parameters
value: number
A Number. If the parameter is of a different type, it will get converted to a number or to NaN if it cannot be converted
Returns number
number
Static FormatSearch playground for Format
Format the given number to a specific decimal format
Parameters
value: number
defines the number to format
Optional decimals: number
defines the number of decimals to use
Returns string
the formatted string
Static Get Class NameSearch playground for GetClassName
This method will return the name of the class used to create the instance of the given object. It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
Parameters
object: any
the object to get the class name from
Optional isType: boolean
defines if the object is actually a type
Returns string
the name of the class, will be "object" for a custom data type not using the @className decorator
Static Get FilenameSearch playground for GetFilename
Extracts the filename from a path
Parameters
path: string
defines the path to use
Returns string
the filename
Static Get Folder PathSearch playground for GetFolderPath
Extracts the "folder" part of a path (everything before the filename).
Parameters
uri: string
The URI to extract the info from
Optional returnUnchangedIfNoSlash: boolean
Do not touch the URI if no slashes are present
Returns string
The "folder" part of the path
Static Get Pointer PrefixSearch playground for GetPointerPrefix
Gets the pointer prefix to use
Parameters
engine: Engine
defines the engine we are finding the prefix for
Returns string
"pointer" if touch is enabled. Else returns "mouse"
Static InstantiateSearch playground for Instantiate
Tries to instantiate a new object from a given class name
Parameters
className: string
defines the class name to instantiate
Returns any
the new object or null if the system was not able to do the instantiation
Static Is Base64Search playground for IsBase64
Test if the given uri is a base64 string
Parameters
uri: string
The uri to test
Returns boolean
True if the uri is a base64 string or false otherwise
Static Is EmptySearch playground for IsEmpty
Gets a boolean indicating if the given object has no own property
Parameters
obj: any
defines the object to test
Returns boolean
true if object has no own property
Static Is Exponent Of TwoSearch playground for IsExponentOfTwo
Function indicating if a number is an exponent of 2
Parameters
value: number
defines the value to test
Returns boolean
true if the value is an exponent of 2
Static Is SafariSearch playground for IsSafari
Utility function to detect if the current user agent is Safari
Returns boolean
whether or not the current user agent is safari
Static Load FileSearch playground for LoadFile
Loads a file from a url
Parameters
url: string
url string, ArrayBuffer, or Blob to load
onSuccess: ((data: string | ArrayBuffer, responseURL?: string) => void)
callback called when the file successfully loads
Parameters
data: string | ArrayBuffer
Optional responseURL: string
Returns void
Optional onProgress: ((data: any) => void)
callback called while file is loading (if the server supports this mode)
Parameters
data: any
Returns void
Optional offlineProvider: IOfflineProvider
defines the offline provider for caching
Optional useArrayBuffer: boolean
defines a boolean indicating that date must be returned as ArrayBuffer
Optional onError: ((request?: WebRequest, exception?: any) => void)
callback called when the file fails to load
Parameters
Optional request: WebRequest
Optional exception: any
Returns void
Returns IFileRequest
a file request object
Static Load File AsyncSearch playground for LoadFileAsync
Loads a file from a url
Parameters
url: string
the file url to load
Optional useArrayBuffer: boolean
defines a boolean indicating that date must be returned as ArrayBuffer
Returns Promise<string | ArrayBuffer>
a promise containing an ArrayBuffer corresponding to the loaded file
Static Load ImageSearch playground for LoadImage
Loads an image as an HTMLImageElement.
Parameters
input: string | Blob | ArrayBuffer
url string, ArrayBuffer, or Blob to load
onLoad: ((img: HTMLImageElement | ImageBitmap) => void)
callback called when the image successfully loads
Parameters
img: HTMLImageElement | ImageBitmap
Returns void
onError: ((message?: string, exception?: any) => void)
callback called when the image fails to load
Parameters
Optional message: string
Optional exception: any
Returns void
offlineProvider: Nullable<IOfflineProvider>
offline provider for caching
Optional mimeType: string
optional mime type
Optional imageBitmapOptions: ImageBitmapOptions
optional the options to use when creating an ImageBitmap
Returns Nullable<HTMLImageElement>
the HTMLImageElement of the loaded image
Static Load ScriptSearch playground for LoadScript
Load a script (identified by an url). When the url returns, the content of this file is added into a new script element, attached to the DOM (body element)
Parameters
scriptUrl: string
defines the url of the script to laod
onSuccess: (() => void)
defines the callback called when the script is loaded
Returns void
Optional onError: ((message?: string, exception?: any) => void)
defines the callback to call if an error occurs
Parameters
Optional message: string
Optional exception: any
Returns void
Optional scriptId: string
defines the id of the script element
Returns void
Static Load Script AsyncSearch playground for LoadScriptAsync
Load an asynchronous script (identified by an url). When the url returns, the content of this file is added into a new script element, attached to the DOM (body element)
Parameters
scriptUrl: string
defines the url of the script to laod
Returns Promise<void>
a promise request object
Static LogSearch playground for Log
Log a message to the console
Parameters
message: string
defines the message to log
Returns void
Static Make ArraySearch playground for MakeArray
Returns an array if obj is not an array
Parameters
obj: any
defines the object to evaluate as an array
Optional allowsNullUndefined: boolean
defines a boolean indicating if obj is allowed to be null or undefined
Returns Nullable<any[]>
either obj directly if obj is an array or a new array containing obj
Static MixSearch playground for Mix
Interpolates between a and b via alpha
Parameters
a: number
The lower value (returned when alpha = 0)
b: number
The upper value (returned when alpha = 1)
alpha: number
The interpolation-factor
Returns number
The mixed value
Static Random IdSearch playground for RandomId
Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523 Be aware Math.random() could cause collisions, but: "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
Returns string
a pseudo random id
Static Read FileSearch playground for ReadFile
Reads a file from a File object
Parameters
file: File
defines the file to load
onSuccess: ((data: any) => void)
defines the callback to call when data is loaded
Parameters
data: any
Returns void
Optional onProgress: ((ev: ProgressEvent<EventTarget>) => any)
defines the callback to call during loading process
Parameters
ev: ProgressEvent<EventTarget>
Returns any
Optional useArrayBuffer: boolean
defines a boolean indicating that data must be returned as an ArrayBuffer
Optional onError: ((error: ReadFileError) => void)
defines the callback to call when an error occurs
Parameters
error: ReadFileError
Returns void
Returns IFileRequest
a file request object
Static Read File As DataURLSearch playground for ReadFileAsDataURL
Loads a file from a blob
Parameters
fileToLoad: Blob
defines the blob to use
callback: ((data: any) => void)
defines the callback to call when data is loaded
Parameters
data: any
Returns void
progressCallback: ((ev: ProgressEvent<EventTarget>) => any)
defines the callback to call during loading process
Parameters
ev: ProgressEvent<EventTarget>
Returns any
Returns IFileRequest
a file request object
Static Register Top Root EventsSearch playground for RegisterTopRootEvents
Function used to register events at window level
Parameters
windowElement: Window
defines the Window object to use
events: { handler: Nullable<((e: FocusEvent) => any)>; name: string }[]
defines the events to register
Returns void
Static Set Cors BehaviorSearch playground for SetCorsBehavior
Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.
Parameters
url: string | string[]
define the url we are trying
element: { crossOrigin: null | string }
define the dom element where to configure the cors policy
cross
Origin: null | string
Returns void
Static Set ImmediateSearch playground for SetImmediate
Polyfill for setImmediate
Parameters
action: (() => void)
defines the action to execute after the current execution block
Returns void
Returns void
Static Set Referrer Policy BehaviorSearch playground for SetReferrerPolicyBehavior
Sets the referrerPolicy behavior on a dom element.
Parameters
referrerPolicy: Nullable<ReferrerPolicy>
define the referrer policy to use
element: { referrerPolicy: null | string }
define the dom element where to configure the referrer policy
referrer
Policy: null | string
Returns void
Static Smooth Angle ChangeSearch playground for SmoothAngleChange
Smooth angle changes (kind of low-pass filter), in particular for device orientation "shaking" Use trigonometric functions to avoid discontinuity (0/360, -180/180)
Parameters
previousAngle: number
defines last angle value, in degrees
newAngle: number
defines new angle value, in degrees
Optional smoothFactor: number
defines smoothing sensitivity; min 0: no smoothing, max 1: new data ignored
Returns number
the angle in degrees
Static To BlobSearch playground for ToBlob
Converts the canvas data to blob. This acts as a polyfill for browsers not supporting the to blob function.
Parameters
canvas: HTMLCanvasElement | OffscreenCanvas
Defines the canvas to extract the data from (can be an offscreen canvas)
successCallback: ((blob: Nullable<Blob>) => void)
Defines the callback triggered once the data are available
Parameters
blob: Nullable<Blob>
Returns void
Optional mimeType: string
Defines the mime type of the result
Optional quality: number
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
quality
parameter.
Returns void
Static To DegreesSearch playground for ToDegrees
Convert an angle in radians to degrees
Parameters
angle: number
defines the angle to convert
Returns number
the angle in degrees
Static To RadiansSearch playground for ToRadians
Convert an angle in degrees to radians
Parameters
angle: number
defines the angle to convert
Returns number
the angle in radians
Static Unregister Top Root EventsSearch playground for UnregisterTopRootEvents
Function used to unregister events from window level
Parameters
windowElement: Window
defines the Window object to use
events: { handler: Nullable<((e: FocusEvent) => any)>; name: string }[]
defines the events to unregister
Returns void
Static WarnSearch playground for Warn
Write a warning message to the console
Parameters
message: string
defines the message to log
Returns void
Static get Full Class NameSearch playground for getFullClassName
This method will return the name of the full name of the class, including its owning module (if any). It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).
Parameters
object: any
the object to get the class name from
Optional isType: boolean
defines if the object is actually a type
Returns Nullable<string>
a string that can have two forms: "moduleName.className" if module was specified when the class' Name was registered or "className" if there was not module specified.
Class containing a set of static utilities functions