xref: /interface/sdk-js/api/common/lite/global.d.ts (revision 61847f8e)
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
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21/**
22 * Sets the interval for repeatedly calling a function.
23 *
24 * @param { Function } handler - Indicates the function to be called repeatedly at the interval.
25 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay.
26 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off.
27 * @returns { number } Returns the timer ID.
28 * @syscap SystemCapability.ArkUI.ArkUI.Lite
29 * @since 5
30 */
31export declare function setInterval(
32  handler: Function,
33  delay: number,
34  ...arguments: any[]
35): number;
36
37/**
38 * Sets a timer after which a function will be executed.
39 *
40 * @param { Function } handler - Indicates the function to be called after the timer goes off.
41 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called.
42 * 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.
43 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off.
44 * @returns { number } Returns the timer ID.
45 * @syscap SystemCapability.ArkUI.ArkUI.Lite
46 * @since 5
47 */
48export declare function setTimeout(
49  handler: Function,
50  delay?: number,
51  ...arguments: any[]
52): number;
53
54/**
55 * Cancels the interval set by " setInterval()".
56 *
57 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()".
58 * @syscap SystemCapability.ArkUI.ArkUI.Lite
59 * @since 5
60 */
61export declare function clearInterval(intervalID?: number): void;
62
63/**
64 * Cancels the timer set by " setTimeout()".
65 *
66 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()".
67 * @syscap SystemCapability.ArkUI.ArkUI.Lite
68 * @since 5
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 *
76 * @param { string } [name] - Java interface name, including package path, such as com.example.test.timeinterfaceimpl.
77 * @returns { any } A promise object is returned. The resolve callback is the object of PA.
78 * The reject callback returns the object containing code and error data.
79 * @syscap SystemCapability.ArkUI.ArkUI.Lite
80 * @since 5
81 * @deprecated since 8
82 */
83export declare function createLocalParticleAbility(name?: string): any;
84
85/**
86 * Conditional compilation for rich equipment
87 *
88 * @syscap SystemCapability.ArkUI.ArkUI.Lite
89 * @since 5
90 */
91export declare const STANDARD: string;
92
93/**
94 * Conditional compilation for lite equipment
95 *
96 * @syscap SystemCapability.ArkUI.ArkUI.Lite
97 * @since 5
98 */
99export declare const LITE: string;
100
101/**
102 * Defining syscap function.
103 *
104 * @param { string } syscap
105 * @returns { boolean }
106 * @syscap SystemCapability.ArkUI.ArkUI.Lite
107 * @since 8
108 */
109export declare function canIUse(syscap: string): boolean;
110
111/**
112 * Obtain the objects exposed in app.js
113 *
114 * @returns { object }
115 * @syscap SystemCapability.ArkUI.ArkUI.Lite
116 * @since 10
117 */
118export declare function getApp(): object;
119