• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 *
21 * @param { Function | string } handler - Indicates the function to be called after the timer goes off.
22 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string.
23 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
24 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay.
25 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off.
26 * @returns { number } Returns the timer ID.
27 * @syscap SystemCapability.ArkUI.ArkUI.Lite
28 * @since 3
29 */
30export declare function setInterval(handler: Function | string, delay: number, ...arguments: any[]): number;
31
32/**
33 * Sets a timer after which a function will be executed.
34 *
35 * @param { Function | string } handler - Indicates the function to be called after the timer goes off.
36 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string.
37 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
38 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called.
39 * 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.
40 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off.
41 * @returns { number } Returns the timer ID.
42 * @syscap SystemCapability.ArkUI.ArkUI.Lite
43 * @since 3
44 */
45export declare function setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number;
46
47/**
48 * Sets a vsync after which a function will be executed.
49 *
50 * @param { Function } handler - Indicates the function to be called when the vsync trigger.
51 * @returns { number }
52 * @syscap SystemCapability.ArkUI.ArkUI.Full
53 * @since 3
54 */
55/**
56 * Sets a vsync after which a function will be executed.
57 *
58 * @param { Function } handler - Indicates the function to be called when the vsync trigger.
59 * @returns { number }
60 * @syscap SystemCapability.ArkUI.ArkUI.Full
61 * @atomicservice
62 * @since 11
63 */
64export declare function requestAnimationFrame(handler: Function): number;
65
66/**
67 * Cancels the vsync callback set by "requestAnimationFrame()".
68 *
69 * @param { number } requestId - Indicates the vsync callback ID returned by "requestAnimationFrame()".
70 * @syscap SystemCapability.ArkUI.ArkUI.Full
71 * @since 3
72 */
73/**
74 * Cancels the vsync callback set by "requestAnimationFrame()".
75 *
76 * @param { number } requestId - Indicates the vsync callback ID returned by "requestAnimationFrame()".
77 * @syscap SystemCapability.ArkUI.ArkUI.Full
78 * @atomicservice
79 * @since 11
80 */
81export declare function cancelAnimationFrame(requestId: number): void;
82
83/**
84 * Cancels the interval set by " setInterval()".
85 *
86 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()".
87 * @syscap SystemCapability.ArkUI.ArkUI.Lite
88 * @since 3
89 */
90export declare function clearInterval(intervalID?: number): void;
91
92/**
93 * Cancels the timer set by "setTimeout()".
94 *
95 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()".
96 * @syscap SystemCapability.ArkUI.ArkUI.Lite
97 * @since 3
98 */
99export declare function clearTimeout(timeoutID?: number): void;
100
101/**
102 * Get the java interface instance. The java instance needs to register, otherwise it cannot be obtained.
103 * After obtaining the instance, you can call the function with the same name on the Java side.
104 *
105 * @param { string } [name] - Java interface name, including package path, such as com.example.test.timeinterfaceimpl.
106 * @returns { any } A promise object is returned. The resolve callback is the object of PA.
107 * The reject callback returns the object containing code and error data.
108 * @syscap SystemCapability.ArkUI.ArkUI.Lite
109 * @since 5
110 * @deprecated since 8
111 */
112export declare function createLocalParticleAbility(name?: string): any;
113
114/**
115 * Defining syscap function.
116 *
117 * @param { string } syscap
118 * @returns { boolean }
119 * @syscap SystemCapability.ArkUI.ArkUI.Lite
120 * @since 8
121 */
122export declare function canIUse(syscap: string): boolean;
123
124/**
125 * Obtain the objects exposed in app.js
126 *
127 * @returns { object }
128 * @syscap SystemCapability.ArkUI.ArkUI.Lite
129 * @since 6
130 */
131export declare function getApp(): object;
132
133/**
134 * You can create an Image object by calling new Image().
135 *
136 * @syscap SystemCapability.ArkUI.ArkUI.Full
137 * @since 4
138 */
139/**
140 * You can create an Image object by calling new Image().
141 *
142 * @syscap SystemCapability.ArkUI.ArkUI.Full
143 * @atomicservice
144 * @since 11
145 */
146export declare class Image {
147  /**
148   * Network address or local resource. The internal URI is supported.
149   *
150   * @type { string }
151   * @syscap SystemCapability.ArkUI.ArkUI.Full
152   * @since 4
153   */
154  /**
155   * Network address or local resource. The internal URI is supported.
156   *
157   * @type { string }
158   * @syscap SystemCapability.ArkUI.ArkUI.Full
159   * @atomicservice
160   * @since 11
161   */
162  src: string;
163  /**
164   * Image width.
165   *
166   * @type { ?number }
167   * @syscap SystemCapability.ArkUI.ArkUI.Full
168   * @since 4
169   */
170  /**
171   * Image width.
172   *
173   * @type { ?number }
174   * @syscap SystemCapability.ArkUI.ArkUI.Full
175   * @atomicservice
176   * @since 11
177   */
178  width?: number;
179  /**
180   * Image height.
181   *
182   * @type { ?number }
183   * @syscap SystemCapability.ArkUI.ArkUI.Full
184   * @since 4
185   */
186  /**
187   * Image height.
188   *
189   * @type { ?number }
190   * @syscap SystemCapability.ArkUI.ArkUI.Full
191   * @atomicservice
192   * @since 11
193   */
194  height?: number;
195  /**
196   * Called when an image is successfully loaded. This function has no parameter.
197   *
198   * @type { ?function }
199   * @syscap SystemCapability.ArkUI.ArkUI.Full
200   * @since 4
201   */
202  /**
203   * Called when an image is successfully loaded. This function has no parameter.
204   *
205   * @type { ?function }
206   * @syscap SystemCapability.ArkUI.ArkUI.Full
207   * @atomicservice
208   * @since 11
209   */
210  onload?: () => void;
211  /**
212   * Called when an image fails to be loaded. This function has no parameter.
213   *
214   * @type { ?function }
215   * @syscap SystemCapability.ArkUI.ArkUI.Full
216   * @since 4
217   */
218  /**
219   * Called when an image fails to be loaded. This function has no parameter.
220   *
221   * @type { ?function }
222   * @syscap SystemCapability.ArkUI.ArkUI.Full
223   * @atomicservice
224   * @since 11
225   */
226  onerror?: () => void;
227}
228
229/**
230 * An ImageData object is a common object that stores the actual pixel data of a Canvas object.
231 *
232 * @syscap SystemCapability.ArkUI.ArkUI.Full
233 * @since 4
234 */
235/**
236 * An ImageData object is a common object that stores the actual pixel data of a Canvas object.
237 *
238 * @syscap SystemCapability.ArkUI.ArkUI.Full
239 * @atomicservice
240 * @since 11
241 */
242export declare class ImageData {
243  /**
244   * Actual width of the ImageData object, in pixels.
245   *
246   * @type { number }
247   * @syscap SystemCapability.ArkUI.ArkUI.Full
248   * @since 4
249   */
250  /**
251   * Actual width of the ImageData object, in pixels.
252   *
253   * @type { number }
254   * @syscap SystemCapability.ArkUI.ArkUI.Full
255   * @atomicservice
256   * @since 11
257   */
258  width: number;
259  /**
260   * Actual height of the ImageData object, in pixels.
261   *
262   * @type { number }
263   * @syscap SystemCapability.ArkUI.ArkUI.Full
264   * @since 4
265   */
266  /**
267   * Actual height of the ImageData object, in pixels.
268   *
269   * @type { number }
270   * @syscap SystemCapability.ArkUI.ArkUI.Full
271   * @atomicservice
272   * @since 11
273   */
274  height: number;
275  /**
276   * A one-dimensional array of color values. The color values are sorted in the RGBA order and represented by integers from 0 to 255.
277   *
278   * @type { Uint8ClampedArray }
279   * @syscap SystemCapability.ArkUI.ArkUI.Full
280   * @since 4
281   */
282  /**
283   * A one-dimensional array of color values. The color values are sorted in the RGBA order and represented by integers from 0 to 255.
284   *
285   * @type { Uint8ClampedArray }
286   * @syscap SystemCapability.ArkUI.ArkUI.Full
287   * @atomicservice
288   * @since 11
289   */
290  data: Uint8ClampedArray;
291}
292
293/**
294 * OffscreenCanvas provides a Canvas object that can be rendered off-screen.
295 * It works in both window and Web worker environments.
296 *
297 * @syscap SystemCapability.ArkUI.ArkUI.Full
298 * @since 7
299 */
300/**
301 * OffscreenCanvas provides a Canvas object that can be rendered off-screen.
302 * It works in both window and Web worker environments.
303 *
304 * @syscap SystemCapability.ArkUI.ArkUI.Full
305 * @atomicservice
306 * @since 11
307 */
308export declare class OffscreenCanvas {
309  /**
310   * The width of the offScreen Canvas object
311   * The height of the offScreen Canvas object
312   *
313   * @param { number } width
314   * @param { number } height
315   * @syscap SystemCapability.ArkUI.ArkUI.Full
316   * @since 7
317   */
318  /**
319   * The width of the offScreen Canvas object
320   * The height of the offScreen Canvas object
321   *
322   * @param { number } width
323   * @param { number } height
324   * @syscap SystemCapability.ArkUI.ArkUI.Full
325   * @atomicservice
326   * @since 11
327   */
328  constructor(width: number, height: number);
329
330  /**
331   * The width of the offScreen Canvas object
332   *
333   * @type { number }
334   * @syscap SystemCapability.ArkUI.ArkUI.Full
335   * @since 7
336   */
337  /**
338   * The width of the offScreen Canvas object
339   *
340   * @type { number }
341   * @syscap SystemCapability.ArkUI.ArkUI.Full
342   * @atomicservice
343   * @since 11
344   */
345  width: number;
346
347  /**
348   * The height of the offScreen Canvas object
349   *
350   * @type { number }
351   * @syscap SystemCapability.ArkUI.ArkUI.Full
352   * @since 7
353   */
354  /**
355   * The height of the offScreen Canvas object
356   *
357   * @type { number }
358   * @syscap SystemCapability.ArkUI.ArkUI.Full
359   * @atomicservice
360   * @since 11
361   */
362  height: number;
363
364  /**
365   * Gets the context object for off-screen drawing.
366   *
367   * @param { "2d" } contextId - creates a CanvasRenderingContext2D object representing a two-dimensional rendering context.
368   * @param { CanvasRenderingContext2DSettings } [options] - object representing a three-dimensional rendering context.
369   * @returns { OffscreenCanvasRenderingContext2D } a render canvas for the offScreen Canvas object.
370   * @syscap SystemCapability.ArkUI.ArkUI.Full
371   * @since 7
372   */
373  /**
374   * Gets the context object for off-screen drawing.
375   *
376   * @param { "2d" } contextId - creates a CanvasRenderingContext2D object representing a two-dimensional rendering context.
377   * @param { CanvasRenderingContext2DSettings } [options] - object representing a three-dimensional rendering context.
378   * @returns { OffscreenCanvasRenderingContext2D } a render canvas for the offScreen Canvas object.
379   * @syscap SystemCapability.ArkUI.ArkUI.Full
380   * @atomicservice
381   * @since 11
382   */
383  getContext(contextId: "2d", options?: CanvasRenderingContext2DSettings): OffscreenCanvasRenderingContext2D;
384
385  /**
386   * Converts the draw contents of the current off-screen draw object to a string in the form of a Blob.
387   *
388   * @param { string } [type] - indicating the image format.
389   * @param { number } [quality] - between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp.
390   * @returns { string } A Promise returning a Blob object representing the image contained in the canvas.
391   * @syscap SystemCapability.ArkUI.ArkUI.Full
392   * @since 7
393   */
394  /**
395   * Converts the draw contents of the current off-screen draw object to a string in the form of a Blob.
396   *
397   * @param { string } [type] - indicating the image format.
398   * @param { number } [quality] - between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp.
399   * @returns { string } A Promise returning a Blob object representing the image contained in the canvas.
400   * @syscap SystemCapability.ArkUI.ArkUI.Full
401   * @atomicservice
402   * @since 11
403   */
404  toDataURL(type?: string, quality?: number): string;
405
406  /**
407   * Converts the draw content in the current off-screen draw object to a Bitmap object.
408   *
409   * @returns { ImageBitmap } Returns An ImageBitmap object.
410   * @syscap SystemCapability.ArkUI.ArkUI.Full
411   * @since 7
412   */
413  /**
414   * Converts the draw content in the current off-screen draw object to a Bitmap object.
415   *
416   * @returns { ImageBitmap } Returns An ImageBitmap object.
417   * @syscap SystemCapability.ArkUI.ArkUI.Full
418   * @atomicservice
419   * @since 11
420   */
421  transferToImageBitmap(): ImageBitmap;
422}
423
424/**
425 * Defines the ImageBitmap.
426 *
427 * @syscap SystemCapability.ArkUI.ArkUI.Full
428 * @since 7
429 */
430/**
431 * Defines the ImageBitmap.
432 *
433 * @syscap SystemCapability.ArkUI.ArkUI.Full
434 * @atomicservice
435 * @since 11
436 */
437export declare class ImageBitmap {
438  /**
439   * The height of the Image Bitmap object.
440   *
441   * @type { number }
442   * @syscap SystemCapability.ArkUI.ArkUI.Full
443   * @since 7
444   */
445  /**
446   * The height of the Image Bitmap object.
447   *
448   * @type { number }
449   * @syscap SystemCapability.ArkUI.ArkUI.Full
450   * @atomicservice
451   * @since 11
452   */
453  readonly height: number;
454
455  /**
456   * The width of the Image Bitmap object.
457   *
458   * @type { number }
459   * @syscap SystemCapability.ArkUI.ArkUI.Full
460   * @since 7
461   */
462  /**
463   * The width of the Image Bitmap object.
464   *
465   * @type { number }
466   * @syscap SystemCapability.ArkUI.ArkUI.Full
467   * @atomicservice
468   * @since 11
469   */
470  readonly width: number;
471}
472
473/**
474 * Conditional compilation for rich equipment
475 *
476 * @syscap SystemCapability.ArkUI.ArkUI.Lite
477 * @systemapi
478 * @since 4
479 */
480export declare const STANDARD: string;
481
482/**
483 * Conditional compilation for lite equipment
484 *
485 * @syscap SystemCapability.ArkUI.ArkUI.Lite
486 * @systemapi
487 * @since 4
488 */
489export declare const LITE: string;
490