{"id":14988006,"url":"https://github.com/apache/cordova-plugin-vibration","last_synced_at":"2025-04-14T05:17:57.208Z","repository":{"id":9085307,"uuid":"10860607","full_name":"apache/cordova-plugin-vibration","owner":"apache","description":"Apache Cordova Vibration Plugin","archived":false,"fork":false,"pushed_at":"2024-10-26T03:56:04.000Z","size":772,"stargazers_count":127,"open_issues_count":8,"forks_count":131,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-07T01:02:46.768Z","etag":null,"topics":["android","cordova","hacktoberfest","ios","java","javascript","library","mobile","nodejs","objective-c"],"latest_commit_sha":null,"homepage":"https://cordova.apache.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-22T07:00:18.000Z","updated_at":"2024-10-26T03:56:08.000Z","dependencies_parsed_at":"2024-12-06T08:03:17.890Z","dependency_job_id":"060649b6-b40d-45b8-b6b6-7f7c79d7ee92","html_url":"https://github.com/apache/cordova-plugin-vibration","commit_stats":{"total_commits":307,"total_committers":64,"mean_commits":4.796875,"dds":0.762214983713355,"last_synced_commit":"7acf8a4c2e788d02e10320bd5dbcd5fa87d795ec"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-vibration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-vibration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-vibration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-vibration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/cordova-plugin-vibration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248520249,"owners_count":21117905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","cordova","hacktoberfest","ios","java","javascript","library","mobile","nodejs","objective-c"],"created_at":"2024-09-24T14:15:56.715Z","updated_at":"2025-04-14T05:17:57.186Z","avatar_url":"https://github.com/apache.png","language":"JavaScript","readme":"---\ntitle: Vibration\ndescription: Vibrate the device.\n---\n\u003c!--\n# license: Licensed to the Apache Software Foundation (ASF) under one\n#         or more contributor license agreements.  See the NOTICE file\n#         distributed with this work for additional information\n#         regarding copyright ownership.  The ASF licenses this file\n#         to you under the Apache License, Version 2.0 (the\n#         \"License\"); you may not use this file except in compliance\n#         with the License.  You may obtain a copy of the License at\n#\n#           http://www.apache.org/licenses/LICENSE-2.0\n#\n#         Unless required by applicable law or agreed to in writing,\n#         software distributed under the License is distributed on an\n#         \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#         KIND, either express or implied.  See the License for the\n#         specific language governing permissions and limitations\n#         under the License.\n--\u003e\n\n# cordova-plugin-vibration\n\n[![Android Testsuite](https://github.com/apache/cordova-plugin-vibration/actions/workflows/android.yml/badge.svg)](https://github.com/apache/cordova-plugin-vibration/actions/workflows/android.yml) [![Chrome Testsuite](https://github.com/apache/cordova-plugin-vibration/actions/workflows/chrome.yml/badge.svg)](https://github.com/apache/cordova-plugin-vibration/actions/workflows/chrome.yml) [![iOS Testsuite](https://github.com/apache/cordova-plugin-vibration/actions/workflows/ios.yml/badge.svg)](https://github.com/apache/cordova-plugin-vibration/actions/workflows/ios.yml) [![Lint Test](https://github.com/apache/cordova-plugin-vibration/actions/workflows/lint.yml/badge.svg)](https://github.com/apache/cordova-plugin-vibration/actions/workflows/lint.yml)\n\nThis plugin provides a way to vibrate the device. Its API aligns with the W3C vibration specification at http://www.w3.org/TR/vibration/\n\nThe plugin defines a global object/method `navigator.vibrate`. Although in the global scope, it is not available until after the `deviceready` event.\n\n```javascript\ndocument.addEventListener(\"deviceready\", onDeviceReady, false);\nfunction onDeviceReady() {\n    console.log(navigator.vibrate);\n}\n```\n\n## Installation\n\n```console\ncordova plugin add cordova-plugin-vibration\n```\n\n## Supported Platforms\n\n- iOS\n- Windows Phone\n- Android  \n  The Android webview (API level 19 and up) supports the [W3C Vibration API](https://www.w3.org/TR/vibration/) natively, so no Android specific implementation in this plugin is necessary.\n\n## navigator.vibrate\n\nThis function has three different functionalities based on parameters passed to it:\n\n### Standard vibrate\n\nVibrates the device for a given amount of time.\n\n```javascript\nnavigator.vibrate(time)\n```\nor\n```javascript\nnavigator.vibrate([time])\n```\n\n- __time__: Milliseconds to vibrate the device. _(Number)_\n\n#### Example\n\n```javascript\n// Vibrate for 3 seconds\nnavigator.vibrate(3000);\n\n// Vibrate for 3 seconds\nnavigator.vibrate([3000]);\n```\n\n#### Quirks\n\n##### iOS Quirks\n\n- __time__: Ignores the specified time and vibrates for a pre-set amount of time.\n\n    ```javascript\n    navigator.vibrate(3000); // 3000 is ignored\n    ```\n\n##### Windows Phone Quirks\n\n- __time__: Max time is 5000ms (5s) and min time is 1ms\n\n    ```javascript\n    navigator.vibrate(8000); // will be truncated to 5000\n    ```\n\n##### Android Quirks\n\n\u003e Calls to `navigator.vibrate` will immediately return `false` if user hasn't tapped on the frame or any embedded frame yet. \n\nSee https://www.chromestatus.com/feature/5644273861001216\n\n### Vibrate with a pattern\n\nVibrates the device with a given pattern\n\n```javascript\nnavigator.vibrate(pattern);\n```\n- __pattern__: Sequence of durations (in milliseconds) for which to turn on or off the vibrator. _(Array of Numbers)_\n\n#### Example\n\n```javascript\n// Vibrate for 1 second\n// Wait for 1 second\n// Vibrate for 3 seconds\n// Wait for 1 second\n// Vibrate for 5 seconds\nnavigator.vibrate([1000, 1000, 3000, 1000, 5000]);\n```\n\n#### Quirks\n\n- Not supported on iOS\n\n### Cancel vibration\n\nImmediately cancels any currently running vibration.\n```javascript\nnavigator.vibrate(0)\n```\nor\n```javascript\nnavigator.vibrate([])\n```\nor\n```javascript\nnavigator.vibrate([0])\n```\nPassing in a parameter of 0, an empty array, or an array with one element of value 0 will cancel any vibrations.\n\n#### Quirks\n\n- Not supported on iOS\n","funding_links":[],"categories":["Index"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fcordova-plugin-vibration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fcordova-plugin-vibration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fcordova-plugin-vibration/lists"}