Pressure

Devices implement force differently pressure is trying to solve it across all devices, with polyfill and multi touch support.

Get it:npm install pressure

Sample usage:

123456789101112131415161718192021222324

constPressure=require('pressure');Pressure.set('#element',{start:function(event){// this is called on force start},end:function(){// this is called on force end},startDeepPress:function(event){// this is called on "force click" / "deep press", aka once the force is greater than 0.5},endDeepPress:function(){// this is called when the "force click" / "deep press" end},change:function(force,event){// this is called every time there is a change in pressure// force will always be a value from 0 to 1 on mobile and desktop},unsupported:function(){// NOTE: this is only called if the polyfill option is disabled!// this is called once there is a touch on the element and the device or browser does not support Force or 3D touch}});