Skip to content

Interface: CanvasImage ​

Defined in: types/desktop-engine.d.ts:977

A canvas image texture (similar to HTMLImageElement; used only for canvas drawing, not a view)

Extends ​

Properties ​

complete ​

ts
readonly complete: boolean;

Defined in: types/desktop-engine.d.ts:988

Whether the image loaded successfully


height ​

ts
readonly height: number;

Defined in: types/desktop-engine.d.ts:986

Texture height


nodeName ​

ts
readonly nodeName: string;

Defined in: types/desktop-engine.d.ts:990

Always "IMG"


onerror ​

ts
onerror: 
  | EventHandler<CanvasImage, void>
  | null
  | undefined;

Defined in: types/desktop-engine.d.ts:999

error callback


onload ​

ts
onload: 
  | EventHandler<CanvasImage, void>
  | null
  | undefined;

Defined in: types/desktop-engine.d.ts:997

load callback


src ​

ts
src: string;

Defined in: types/desktop-engine.d.ts:982

Image source: an http(s) URL, a data URI or a FilePath (in the package, like /a.png, ./a.png or a.png, or in the sandbox); other paths fire error. Assign an empty string to release the texture


tagName ​

ts
readonly tagName: string;

Defined in: types/desktop-engine.d.ts:992

Always "IMG"


width ​

ts
readonly width: number;

Defined in: types/desktop-engine.d.ts:984

Texture width

Methods ​

addEventListener() ​

ts
addEventListener<K>(type, listener): void;

Defined in: types/desktop-engine.d.ts:128

Adds an event listener; type may be given with or without the on prefix

Type Parameters ​

Type Parameter
K extends "error" | "load"

Parameters ​

ParameterType
typeK | `on${K}`
listenerEventHandler<CanvasImage, CanvasImageEventMap[K]>

Returns ​

void

Inherited from ​

EventedObject.addEventListener


destroy() ​

ts
destroy(): void;

Defined in: types/desktop-engine.d.ts:132

Clears all event listeners and on callbacks so the object can be garbage-collected; components also process their children recursively

Returns ​

void

Inherited from ​

EventedObject.destroy


loadFromLocal() ​

ts
loadFromLocal(path): void;

Defined in: types/desktop-engine.d.ts:994

Loads a local image (a FilePath) synchronously, with deferred decoding, then fires load or error

Parameters ​

ParameterType
pathstring

Returns ​

void


offerror() ​

ts
offerror(): void;

Defined in: types/desktop-engine.d.ts:1003

Removes the onerror callback

Returns ​

void


offload() ​

ts
offload(): void;

Defined in: types/desktop-engine.d.ts:1001

Removes the onload callback

Returns ​

void


removeEventListener() ​

ts
removeEventListener<K>(type, listener): void;

Defined in: types/desktop-engine.d.ts:130

Removes the given event listener

Type Parameters ​

Type Parameter
K extends "error" | "load"

Parameters ​

ParameterType
typeK | `on${K}`
listenerEventHandler<CanvasImage, CanvasImageEventMap[K]>

Returns ​

void

Inherited from ​

EventedObject.removeEventListener

The SDK is released under the Apache License 2.0