From c99f06e3a90bf193c89728bbebfca4ff6ffd04d3 Mon Sep 17 00:00:00 2001 From: lyj_love_code Date: Mon, 30 Aug 2021 17:10:11 +0800 Subject: [PATCH 1/3] add ohos.hiAppEvent.d.ts Signed-off-by: lyj_love_code --- api/@ohos.hiAppEvent.d.ts | 127 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 api/@ohos.hiAppEvent.d.ts diff --git a/api/@ohos.hiAppEvent.d.ts b/api/@ohos.hiAppEvent.d.ts new file mode 100644 index 0000000000..be43408a67 --- /dev/null +++ b/api/@ohos.hiAppEvent.d.ts @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { AsyncCallback } from './phone/basic'; + +/** + * Provides the event logging function for applications to log the fault, statistical, security, + * and user behavior events reported during running. Based on event information, + * you will be able to analyze the running status of applications. + * + * @since 7 + * @device phone, tablet, tv, wearable + */ +declare namespace hiAppEvent { + /** + * Enumerate application event types. + */ + enum EventType { + /** + * Fault Event. + */ + FAULT = 1, + + /** + * Statistic event. + */ + STATISTIC = 2, + + /** + * Security event. + */ + SECURITY = 3, + + /** + * User behavior event. + */ + BEHAVIOR = 4 + } + + /** + * Preset event. + */ + namespace Event { + /** + * user login event. + */ + const USER_LOGIN: string; + + /** + * user logout event. + */ + const USER_LOGOUT: string; + + /** + * distributed service event. + */ + const DISTRIBUTED_SERVICE_START: string; + } + + /** + * Preset param. + */ + namespace Param { + /** + * user id. + */ + const USER_ID: string; + + /** + * distributed service name. + */ + const DISTRIBUTED_SERVICE_NAME: string; + + /** + * distributed service instance id. + */ + const DISTRIBUTED_SERVICE_INSTANCE_ID: string; + } + + /** + * write application event. + * + * @static + * @param {string} eventName application event name. + * @param {EventType} eventType application event type. + * @param {object} keyValues application event key-value pair params. + * @param {AsyncCallback} [callback] callback function. + * @return {void | Promise} no callback return Promise otherwise return void. + */ + function write(eventName: string, eventType: EventType, keyValues: object): Promise; + function write(eventName: string, eventType: EventType, keyValues: object, callback: AsyncCallback): void; + + /** + * application event logging configuration interface. + * + * @static + * @param {ConfigOption} config application event logging configuration item object. + * @return {boolean} configuration result. + */ + function configure(config: ConfigOption): boolean; + + interface ConfigOption { + /** + * configuration item: application event logging switch. + */ + disable?: boolean; + + /** + * configuration item: event file directory storage quota size. + */ + maxStorage?: string; + } +} + +export default hiAppEvent; \ No newline at end of file -- Gitee From c3956cf3a657754b1f38845f801ea5d797fb1db7 Mon Sep 17 00:00:00 2001 From: lyj_love_code Date: Mon, 30 Aug 2021 17:22:27 +0800 Subject: [PATCH 2/3] fix the spelling of the hiAppEvent.d.ts Signed-off-by: lyj_love_code --- api/@ohos.hiAppEvent.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/api/@ohos.hiAppEvent.d.ts b/api/@ohos.hiAppEvent.d.ts index be43408a67..7131243499 100644 --- a/api/@ohos.hiAppEvent.d.ts +++ b/api/@ohos.hiAppEvent.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import { AsyncCallback } from './phone/basic'; @@ -21,7 +21,7 @@ import { AsyncCallback } from './phone/basic'; * you will be able to analyze the running status of applications. * * @since 7 - * @device phone, tablet, tv, wearable + * @devices phone, tablet, tv, wearable */ declare namespace hiAppEvent { /** @@ -29,7 +29,7 @@ declare namespace hiAppEvent { */ enum EventType { /** - * Fault Event. + * Fault event. */ FAULT = 1, -- Gitee From 300d5325064c0841ecddf0fc22470ff67275acb6 Mon Sep 17 00:00:00 2001 From: lyj_love_code Date: Tue, 31 Aug 2021 09:48:46 +0800 Subject: [PATCH 3/3] move @ohos.hiAppEvent.d.ts Signed-off-by: lyj_love_code --- api/{ => phone}/@ohos.hiAppEvent.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename api/{ => phone}/@ohos.hiAppEvent.d.ts (94%) diff --git a/api/@ohos.hiAppEvent.d.ts b/api/phone/@ohos.hiAppEvent.d.ts similarity index 94% rename from api/@ohos.hiAppEvent.d.ts rename to api/phone/@ohos.hiAppEvent.d.ts index 7131243499..42b2b9734f 100644 --- a/api/@ohos.hiAppEvent.d.ts +++ b/api/phone/@ohos.hiAppEvent.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { AsyncCallback } from './phone/basic'; +import { AsyncCallback } from './basic'; /** * Provides the event logging function for applications to log the fault, statistical, security, -- Gitee