1/* 2 * Copyright (c) 2022 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 * Global Input Event Listener 17 * System API, available only to system processes 18 * @since 7 19 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 20 * @import import inputMonitor from '@ohos.multimodalInput.inputMonitor'; 21 * @permission ohos.permission.INPUT_MONITORING 22 * @systemapi hide for inner use 23 */ 24declare namespace inputMonitor { 25 /** 26 * Callback function of the touch input event. If true is returned, the touch input is consumed by the monitor (the system performs the closing action). 27 * @since 7 28 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 29 * @systemapi hide for inner use 30 */ 31 interface TouchEventReceiver { 32 (touchEvent:TouchEvent): Boolean; 33 } 34 35 /** 36 * Listening for touch input events 37 * @since 7 38 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 39 * @systemapi hide for inner use 40 * @permission ohos.permission.INPUT_MONITORING 41 * @param type register event type 42 * @param receiver callback function, receive reported data 43 */ 44 function on(type:"touch", receiver:TouchEventReceiver):void; 45 46 /** 47 * Cancels listening for touch input events 48 * @since 7 49 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 50 * @systemapi hide for inner use 51 * @permission ohos.permission.INPUT_MONITORING 52 * @param type register event type 53 * @param receiver callback function, receive reported data 54 */ 55 function off(type:"touch", receiver?:TouchEventReceiver):void; 56} 57export default inputMonitor; 58