Coder Social home page Coder Social logo

slugify's Introduction

Haptics

The Haptics API provides physical feedback to the user through touch or vibration.

Android Notes

To use vibration, you must add this permission to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.VIBRATE" />

Example

import {
  Plugins,
  HapticsImpactStyle
} from '@capacitor/core';

const { Haptics } = Plugins;

export class HapticsExample {
  hapticsImpact(style = HapticsImpactStyle.Heavy) {
    Haptics.impact({
      style: style
    });
  }

  hapticsImpactMedium(style) {
    this.hapticsImpact(HapticsImpactStyle.Medium);
  }

  hapticsImpactLight(style) {
    this.hapticsImpact(HapticsImpactStyle.Light);
  }

  hapticsVibrate() {
    Haptics.vibrate();
  }

  hapticsSelectionStart() {
    Haptics.selectionStart();
  }

  hapticsSelectionChanged() {
    Haptics.selectionChanged();
  }

  hapticsSelectionEnd() {
    Haptics.selectionEnd();
  }
}

API

impact

impact(options: HapticsImpactOptions, x?: number | undefined) => Promise<HapticsImpact>

Trigger a haptics "impact" feedback

Param Type Description
options HapticsImpactOptions The impact options
x number

Returns: Promise<HapticsImpact>

Since: 1.0.0


notification

notification(options?: HapticsNotificationOptions | undefined) => Promise<string | number>

Trigger a haptics "notification" feedback

Param Type
options HapticsNotificationOptions

Returns: Promise<string | number>

Since: 1.0.0


vibrate

vibrate(options?: VibrateOptions | undefined) => Promise<number>

Vibrate the device

Param Type
options VibrateOptions

Returns: Promise<number>

Since: 1.0.0


selectionStart

selectionStart(value: number | string) => Promise<void>

Trigger a selection started haptic hint

Param Type
value string | number

Returns: Promise<void>

Since: 1.0.0


Interfaces

HapticsImpact

Prop Type
value number

HapticsImpactOptions

Prop Type Description Default Since
style HapticsImpactStyle Impact Feedback Style The mass of the objects in the collision simulated by a UIImpactFeedbackGenerator object. HapticsImpactStyle.Heavy 1.0.0
value boolean

HapticsNotificationOptions

Prop Type Description Default Since
type HapticsNotificationType Notification Feedback Type The type of notification feedback generated by a UINotificationFeedbackGenerator object. HapticsNotificationType.SUCCESS 1.0.0

VibrateOptions

Prop Type Description Default Since
duration number Duration of the vibration in milliseconds. Not supported in iOS. 300 1.0.0

Enums

HapticsImpactStyle

Members Value Description Since
Heavy 'HEAVY' A collision between small, light user interface elements 1.0.0
Medium 'MEDIUM' A collision between moderately sized user interface elements 1.0.0
Light 'LIGHT' A collision between small, light user interface elements 1.0.0

HapticsNotificationType

Members Value Description Since
SUCCESS 'SUCCESS' A notification feedback type indicating that a task has completed successfully 1.0.0
WARNING 'WARNING' A notification feedback type indicating that a task has produced a warning 1.0.0
ERROR 'ERROR' A notification feedback type indicating that a task has failed 1.0.0

slugify's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.