mirror of
https://github.com/Modernizr/Modernizr.git
synced 2026-01-09 23:57:57 -05:00
* Convert jsdoc HTTP to HTTPS (#2338) Convert http -> https in JSDocs. * Finish checking http hyperlinks in jsDocs - Links in jsDocs that are working but do not have HTTPS are left as is. - Dead links are replaced with archived links if obtainable, otherwise new links with similar information. * Fixes to some HTTPS Links - Fixing comments - Pointing to archived links - Replacing with new links * Fixing HTTPS:// links in jsDocs - Unify WFC comment name - Change some links to new redirected links - Change some links to acrhived links * Changing old links to new redirected links * Updates for pull request - Fix missing square bracket - Update generic names (i.e. WHATWG, MDN, Html5 Rocks) - Update archive links to most recent working links - Point link to direct issue for oninput.js
30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
/*!
|
|
{
|
|
"name": "Force Touch Events",
|
|
"property": "forcetouch",
|
|
"authors": ["Kraig Walker"],
|
|
"notes": [{
|
|
"name": "Responding to Force Touch Events from JavaScript",
|
|
"href": "https://developer.apple.com/library/archive/documentation/AppleApplications/Conceptual/SafariJSProgTopics/RespondingtoForceTouchEventsfromJavaScript.html"
|
|
}]
|
|
}
|
|
!*/
|
|
/* DOC
|
|
Tests whether the browser supports the detection of Force Touch Events.
|
|
Force Touch Events allow custom behaviours and interactions to take place based on the given pressure or change in pressure from a compatible trackpad.
|
|
|
|
Force Touch events are available in OS X 10.11 and later on devices equipped with Force Touch trackpads.
|
|
*/
|
|
define(['Modernizr', 'hasEvent', 'prefixed'], function(Modernizr, hasEvent, prefixed) {
|
|
Modernizr.addTest('forcetouch', function() {
|
|
// github.com/Modernizr/Modernizr/issues/1613
|
|
// Test if the browser supports the force touch event progression (see notes link)
|
|
if (!hasEvent(prefixed('mouseforcewillbegin', window, false), window)) {
|
|
return false;
|
|
}
|
|
|
|
// Test if the browser provides thresholds defining a "force touch" from a normal touch/click event
|
|
return MouseEvent.WEBKIT_FORCE_AT_MOUSE_DOWN && MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN;
|
|
});
|
|
});
|