@21kb/react-vibration-hook 中文文档教程
@21kb/react-vibration-hook
振动 API 的 React 钩子
Install
npm
npm install --save @21kb/react-vibration-hook
Yarn
yarn add @21kb/react-vibration-hook
Usage
import useVibration from '@21kb/react-vibration-hook';
function Component() {
const [vibrate, vibration] = useVibration();
return (
<div>
<button onClick={() => vibrate()}>Vibrate for 200ms (the default)</button>
<button onClick={() => vibrate(350)}>Vibrate for 350ms</button>
<button onClick={() => vibrate([350, 200, 400, 200, 450, 200, 500])}>Vibrate for 350ms, then pause 200ms, and so on...</button>
</div>
)
}
License
使用MIT
@21kb/react-vibration-hook
React hook to use the Vibration API
Install
npm
npm install --save @21kb/react-vibration-hook
Yarn
yarn add @21kb/react-vibration-hook
Usage
import useVibration from '@21kb/react-vibration-hook';
function Component() {
const [vibrate, vibration] = useVibration();
return (
<div>
<button onClick={() => vibrate()}>Vibrate for 200ms (the default)</button>
<button onClick={() => vibrate(350)}>Vibrate for 350ms</button>
<button onClick={() => vibrate([350, 200, 400, 200, 450, 200, 500])}>Vibrate for 350ms, then pause 200ms, and so on...</button>
</div>
)
}
License
MIT
更多
你可能也喜欢
- 1dr-build-utilities 中文文档教程
- 9ight 中文文档教程
- @0devs/error 中文文档教程
- @1stquad/swagger-typescript-codegen 中文文档教程
- @2ndaddress/sa-icons 中文文档教程
- @3nuc/vue-tsc-component-library-example 中文文档教程
- @4a/sign 中文文档教程
- @4geit/swg-destructuring-parameters-helper 中文文档教程
- @4geit/swg-get-user-with-api-token-helper 中文文档教程
- @9renpoto/eslint-config-react 中文文档教程