1/* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { OffscreenCanvasRenderingContext2D } from './viewmodel' 17 18/** 19 * Sets the interval for repeatedly calling a function. 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @param handler Indicates the function to be called after the timer goes off. For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 22 * @param delay Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. 23 * @param arguments Indicates additional arguments to pass to "handler" when the timer goes off. 24 * @returns Returns the timer ID. 25 * @since 3 26 */ 27export declare function setInterval(handler: Function | string, delay: number, ...arguments: any[]): number; 28 29/** 30 * Sets a timer after which a function will be executed. 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @param handler Indicates the function to be called after the timer goes off. For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 33 * @param delay Indicates the delay (in milliseconds) after which the function will be called. If this parameter is left empty, default value "0" will be used, which means that the function will be called immediately or as soon as possible. 34 * @param arguments Indicates additional arguments to pass to "handler" when the timer goes off. 35 * @returns Returns the timer ID. 36 * @since 3 37 */ 38export declare function setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number; 39 40/** 41 * Sets a vsync after which a function will be executed. 42 * @syscap SystemCapability.ArkUI.ArkUI.Full 43 * @param handler Indicates the function to be called when the vsync trigger. 44 * @since 3 45 */ 46export declare function requestAnimationFrame(handler: Function): number; 47 48/** 49 * Cancels the vsync callback set by "requestAnimationFrame()". 50 * @syscap SystemCapability.ArkUI.ArkUI.Full 51 * @param requestId Indicates the vsync callback ID returned by "requestAnimationFrame()". 52 * @since 3 53 */ 54export declare function cancelAnimationFrame(requestId: number): void; 55 56/** 57 * Cancels the interval set by " setInterval()". 58 * @syscap SystemCapability.ArkUI.ArkUI.Full 59 * @param intervalID Indicates the timer ID returned by "setInterval()". 60 * @since 3 61 */ 62export declare function clearInterval(intervalID?: number): void; 63 64/** 65 * Cancels the timer set by "setTimeout()". 66 * @syscap SystemCapability.ArkUI.ArkUI.Full 67 * @param timeoutID Indicates the timer ID returned by "setTimeout()". 68 * @since 3 69 */ 70export declare function clearTimeout(timeoutID?: number): void; 71 72/** 73 * Get the java interface instance. The java instance needs to register, otherwise it cannot be obtained. 74 * After obtaining the instance, you can call the function with the same name on the Java side. 75 * @param name Java interface name, including package path, such as com.example.test.timeinterfaceimpl. 76 * @returns A promise object is returned. The resolve callback is the object of PA. The reject callback returns the object containing code and error data. 77 * @since 5 78 * @deprecated since 8 79 */ 80export declare function createLocalParticleAbility(name?: string): any; 81 82/** 83 * Defining syscap function. 84 * @since 8 85 */ 86export declare function canIUse(syscap: string): boolean; 87 88/** 89 * Obtain the objects exposed in app.js 90 * @syscap SystemCapability.ArkUI.ArkUI.Full 91 * @since 6 92 */ 93export declare function getApp(): object; 94 95/** 96 * You can create an Image object by calling new Image(). 97 * @syscap SystemCapability.ArkUI.ArkUI.Full 98 * @since 4 99 */ 100export declare class Image { 101 /** 102 * Network address or local resource. The internal URI is supported. 103 * @since 4 104 */ 105 src: string; 106 /** 107 * Image width. 108 * @since 4 109 */ 110 width?: number; 111 /** 112 * Image height. 113 * @since 4 114 */ 115 height?: number; 116 /** 117 * Called when an image is successfully loaded. This function has no parameter. 118 * @since 4 119 */ 120 onload?: () => void; 121 /** 122 * Called when an image fails to be loaded. This function has no parameter. 123 * @since 4 124 */ 125 onerror?: () => void; 126} 127 128/** 129 * An ImageData object is a common object that stores the actual pixel data of a Canvas object. 130 * @syscap SystemCapability.ArkUI.ArkUI.Full 131 * @since 4 132 */ 133export declare class ImageData { 134 /** 135 * Actual width of the ImageData object, in pixels. 136 * @since 4 137 */ 138 width: number; 139 /** 140 * Actual height of the ImageData object, in pixels. 141 * @since 4 142 */ 143 height: number; 144 /** 145 * A one-dimensional array of color values. The color values are sorted in the RGBA order and represented by integers from 0 to 255. 146 * @since 4 147 */ 148 data: Uint8ClampedArray; 149} 150 151/** 152 * OffscreenCanvas provides a Canvas object that can be rendered off-screen. 153 * It works in both window and Web worker environments. 154 * @syscap SystemCapability.ArkUI.ArkUI.Full 155 * @since 7 156 */ 157export declare class OffscreenCanvas { 158 /** 159 * The width of the offScreen Canvas object 160 * The height of the offScreen Canvas object 161 * @since 7 162 */ 163 constructor(width: number, height: number); 164 165 /** 166 * The width of the offScreen Canvas object 167 * @since 7 168 */ 169 width: number; 170 171 /** 172 * The height of the offScreen Canvas object 173 * @since 7 174 */ 175 height: number; 176 177 /** 178 * Gets the context object for off-screen drawing. 179 * @param contextId creates a CanvasRenderingContext2D object representing a two-dimensional rendering context. 180 * @param options object representing a three-dimensional rendering context. 181 * @returns a render canvas for the offScreen Canvas object. 182 * @since 7 183 */ 184 getContext(contextId: "2d", options?: CanvasRenderingContext2DSettings): OffscreenCanvasRenderingContext2D; 185 186 /** 187 * Converts the draw contents of the current off-screen draw object to a string in the form of a Blob. 188 * @param type indicating the image format. 189 * @param quality between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. 190 * @returns A Promise returning a Blob object representing the image contained in the canvas. 191 * @since 7 192 */ 193 toDataURL(type?: string, quality?: number): string; 194 195 /** 196 * Converts the draw content in the current off-screen draw object to a Bitmap object. 197 * @returns Returns An ImageBitmap object. 198 * @since 7 199 */ 200 transferToImageBitmap(): ImageBitmap; 201} 202 203/** 204 * Defines the ImageBitmap. 205 * @syscap SystemCapability.ArkUI.ArkUI.Full 206 * @since 7 207 */ 208export declare class ImageBitmap { 209 /** 210 * The height of the Image Bitmap object. 211 * @since 7 212 */ 213 readonly height: number; 214 215 /** 216 * The width of the Image Bitmap object. 217 * @since 7 218 */ 219 readonly width: number; 220} 221 222/** 223 * Conditional compilation for rich equipment 224 * @syscap SystemCapability.ArkUI.ArkUI.Full 225 * @since 4 226 * @systemapi 227 */ 228export declare const STANDARD: string; 229 230/** 231 * Conditional compilation for lite equipment 232 * @syscap SystemCapability.ArkUI.ArkUI.Full 233 * @since 4 234 * @systemapi 235 */ 236export declare const LITE: string; 237