pressure.js
Pressure is a JavaScript library that makes dealing with Apple's Force Touch and 3D Touch simple. Force Touch for new Macs and 3D Touch for the new iPhone 6s and 6s Plus, all bundled under one roof with a simple API that makes working with them painless.
Head over to the documentation website for installation instructions and how to use pressure.js
Install
download pressure.min.js or pressure.js files from GitHub or install with npm or bower
npm
npm install pressure --save
bower
bower install pressure --save
Setup
Use pressure in the global space:
Pressure.set('#id-name', {
change: function(force){
this.innerHTML = forcel
}
});
OR use it with browserify or CommonJS like setups:
var Pressure = require('pressure');
Pressure.set('#id-name', {
change: function(force){
this.innerHTML = forcel
}
});
Usage
NOTE: the "this" keyword in each of the callback methods will be the element itself that has force applied to it
Pressure.set('#element', {
start: function(){
},
end: function(){
},
startDeepPress: function(){
},
endDeepPress: function(){
},
change: function(force, event){
},
unsupported: function(){
}
});