Coder Social home page Coder Social logo

kcmr / good-vibrations Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.78 MB

Web Component that uses the Vibration API in browsers that support it

Home Page: http://kcmr.github.io/good-vibrations/

License: MIT License

HTML 84.91% JavaScript 15.09%
web-components polymer polymer-2x vibration-api mobile

good-vibrations's Introduction

<good-vibrations>

Published on webcomponents.org

<good-vibrations> is a component meant to be used as a singleton, that uses the Vibration API to emit vibrations in browsers that support it.
<good-vibrations> demo

Live demo

Installation and import

Install the component using Bower:

$ bower i -S good-vibrations

Import Web Components loader (optional) and the component:

<script src="bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="bower_components/good-vibrations/good-vibrations.html"> 

Usage

Example:

<good-vibrations vibrate duration="100"></good-vibrations>

Example with vibration / silence intervals:

<good-vibrations vibrate duration="100,200,50,100,50,100,100,200,200,400,100,200,200"></good-vibrations>

Canceling any running vibration:

document.querySelector('good-vibrations').cancel();

Or declaratively using the boolean attribute mute:

<good-vibrations mute></good-vibrations>

Get Vibration API support:

<good-vibrations vibration-supported="{{apiSupported}}"></good-vibrations>

<template is="dom-if" if="[[!apiSupported]]">
  <p>Vibration API not supported</p>
</template>

Development

browserSync and eslint support.
eslint and eslint --fix are enabled by default. Edit tasks/config.json to change the default configuration.

  1. Install npm dependencies: npm install
  2. Launch the component's demo: npm run serve

good-vibrations's People

Contributors

kcmr avatar

Watchers

 avatar  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.