• 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
16/**
17 * @syscap SystemCapability.Sensors.MiscDevice
18 * @import import vibrator from '@system.vibrator';
19 * @permission ohos.permission.VIBRATE
20 * @since 3
21 * @deprecated since 8
22 */
23export interface VibrateOptions {
24  /**
25   * Vibration mode. The value long indicates long vibration, and short indicates short vibration.
26   * The default value is long.
27   * @since 3
28   */
29  mode?: "long" | "short";
30
31  /**
32   * Called when success to trigger vibration.
33   * @since 3
34   */
35  success: () => void;
36
37  /**
38   * Called when fail to trigger vibration.
39   * @since 3
40   */
41  fail?: (data: string, code: number) => void;
42
43  /**
44   * Called when the execution is completed.
45   * @since 3
46   */
47  complete?: () => void;
48}
49
50/**
51 * @syscap SystemCapability.Sensors.MiscDevice
52 * @import import vibrator from '@system.vibrator';
53 * @permission ohos.permission.VIBRATE
54 * @since 3
55 * @deprecated since 8
56 */
57export default class Vibrator {
58  /**
59   * Triggers vibration.
60   * @param options Options.
61   * @permission ohos.permission.VIBRATE
62   * @since 3
63   * @deprecated since 8
64   */
65  static vibrate(options?: VibrateOptions): void;
66}
67