npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jquery-navigator-vibrate

v1.0.2

Published

Vibrate the web 📳 jQuery plugin written in TypeScript that's a light wrapper around navigator.vibrate()

Downloads

22

Readme

📳 jquery-navigator-vibrate

CI

A light wrapper around window.navigator.vibrate() so you can use it with jQuery.

👉 View demo

Browser support

At the time of publishing, browser support is limited to Chrome, Edge, and Android browsers.

Safari and Safari on iOS do not currently support window.navigator.vibrate().

Usage

Installation

Download the package and import the ./lib/jquery-navigator-vibrate.js file after jQuery.

You can also install via NPM:

npm install jquery-navigator-vibrate --save

Or Yarn:

yarn add jquery-navigator-vibrate

Add it to your build tooling and insure it loads in the browser.

Implementation

Find an element with jQuery and execute the plugin with options:

$('.js-vibrating-btn').vibrate({
  time: 300,
  style: 'constant',
  event: 'click',
  pulseCount: 3,
  pulseInterval: 300,
  onVibrateComplete: function () {}
});

It assumes you have HTML as follows:

<button class="js-vibrating-btn">click me</button>

Options

time

  • Integer (default: 300)
  • Integer list, e.g. [100, 200, 300]

Time in milliseconds for the length of the vibration or a list of integers.

style

Enum ( constant | pulse | list ) (default: constant)

constant

A single vibration for the time specified

pulse

A number of vibrations. Uses properties pulseCount and pulseInterval.

list

An array of numbers. This is an alternative to using pulse. To learn about this method, read the documentation for the Vibration API.

pulseCount

Integer (default: 3)

Number of times to vibrate.

pulseInterval

Integer (default: 300)

Time in milliseconds for the length of the interval between vibrations.

event

String (default: click)

The DOM event to listen to, i.e. $(selector).on(event)

onVibrateComplete

Function

An optional function to call when the vibration is complete.

Development

You'll need to run 2 terminal windows:

Run the dev server

This hosts the index.html file and points to the compiled library.

npm start

Run the TypeScript compilation

This runs the TypeScript compilation and outputs it to ./lib/jquery-navigator-vibrate.js

npm run dev