{"_id":"detect-pointer-events","_rev":"8-670ec217caad1de4f99d26a8d7b36da9","name":"detect-pointer-events","description":"Detect if the browser supports the pointer events api","dist-tags":{"latest":"1.0.2"},"versions":{"0.1.0":{"name":"detect-pointer-events","version":"0.1.0","description":"Detect if the browser supports the pointer events api","main":"lib/index.js","scripts":{"build":"rm -rf lib && babel src --presets babel-preset-es2015 -d lib","prepublish":"npm run build"},"files":["lib","src"],"repository":{"type":"git","url":"git+https://github.com/rafrex/detect-pointer-events.git"},"keywords":["pointer events","pointer","touch"],"author":{"name":"Rafael Pedicini","email":"code@rafrex.com"},"license":"MIT","bugs":{"url":"https://github.com/rafrex/detect-pointer-events/issues"},"homepage":"https://github.com/rafrex/detect-pointer-events#readme","devDependencies":{"babel-cli":"^6.10.1","babel-preset-es2015":"^6.9.0","eslint":"^3.0.1","eslint-config-airbnb-base":"^4.0.0","eslint-plugin-import":"^1.10.2"},"gitHead":"7151352dbc87dd1c8d8e0abfbdcf2229a4eee647","_id":"detect-pointer-events@0.1.0","_shasum":"58f1de654b8785325946f03682ab30bf122f4bbf","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.0","_npmUser":{"name":"rafrex","email":"code@rafrex.com"},"dist":{"shasum":"58f1de654b8785325946f03682ab30bf122f4bbf","tarball":"https://registry.npmjs.org/detect-pointer-events/-/detect-pointer-events-0.1.0.tgz","integrity":"sha512-rmyxCJCekdgLjiO5hbVaVGcjQiCQSvGqjSQg/fSQB7F77p+Kj4uEDUtbR6kA9mn1gd5RTJ3NHGDTYf5k3cV9UA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDk16zk+YI541dNjumbxmMq3CPWMBBVtVylOqmJVfPH5AiEA7S+DQAOjCXdXPrvtFF8J/lCP6iajIWsBhaSSSbSUDKg="}]},"maintainers":[{"name":"rafrex","email":"code@rafrex.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/detect-pointer-events-0.1.0.tgz_1467861640243_0.8963533092755824"},"directories":{}},"0.1.1":{"name":"detect-pointer-events","version":"0.1.1","description":"Detect if the browser supports the pointer events api","main":"lib/index.js","scripts":{"build":"rm -rf lib && babel src --presets babel-preset-es2015 -d lib","prepublish":"npm run build"},"files":["lib","src"],"repository":{"type":"git","url":"git+https://github.com/rafrex/detect-pointer-events.git"},"keywords":["pointer events","pointer","touch"],"author":{"name":"Rafael Pedicini","email":"code@rafrex.com"},"license":"MIT","bugs":{"url":"https://github.com/rafrex/detect-pointer-events/issues"},"homepage":"https://github.com/rafrex/detect-pointer-events#readme","devDependencies":{"babel-cli":"^6.10.1","babel-preset-es2015":"^6.9.0","eslint":"^3.0.1","eslint-config-airbnb-base":"^4.0.0","eslint-plugin-import":"^1.10.2"},"gitHead":"2c3304dad62dcb03c4272783c58826cfb3acc899","_id":"detect-pointer-events@0.1.1","_shasum":"8be795d5f96043d667f40159165178afc6c8ddb3","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.0","_npmUser":{"name":"rafrex","email":"code@rafrex.com"},"dist":{"shasum":"8be795d5f96043d667f40159165178afc6c8ddb3","tarball":"https://registry.npmjs.org/detect-pointer-events/-/detect-pointer-events-0.1.1.tgz","integrity":"sha512-W0YP3XKZKoUWFdHsgvvpd3wungi0BZBdewJ2fuNIYDFpKHtqmLlDs0+etEEwDd7awKv513t6wK1nnVACl0iXTA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICf2ydvD/eidvP+AE/WHxgra2YcdwTzwdi4zo8/MRGSrAiEA+6mupbbPbS2l+nxapZEnYs5g17Nj8AeiwUXuuXjDzMA="}]},"maintainers":[{"name":"rafrex","email":"code@rafrex.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/detect-pointer-events-0.1.1.tgz_1467951869331_0.3807958490215242"},"directories":{}},"1.0.0":{"name":"detect-pointer-events","version":"1.0.0","description":"Detect if the browser supports the pointer events api","main":"lib/index.js","scripts":{"build":"rm -rf lib && babel src --presets babel-preset-es2015 -d lib","prepublish":"npm run build"},"files":["lib","src"],"repository":{"type":"git","url":"git+https://github.com/rafrex/detect-pointer-events.git"},"keywords":["detect","pointer events","pointer","touch"],"author":{"name":"Rafael Pedicini","email":"code@rafrex.com"},"license":"MIT","bugs":{"url":"https://github.com/rafrex/detect-pointer-events/issues"},"homepage":"https://github.com/rafrex/detect-pointer-events#readme","devDependencies":{"babel-cli":"^6.10.1","babel-preset-es2015":"^6.9.0","eslint":"^3.0.1","eslint-config-airbnb-base":"^4.0.0","eslint-plugin-import":"^1.10.2"},"gitHead":"a63b9a5490e0d05b0532930eaa7dba8dae54d1a1","_id":"detect-pointer-events@1.0.0","_shasum":"84dbc660fab8f294031bc77118806bda020bbbda","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.0","_npmUser":{"name":"rafrex","email":"code@rafrex.com"},"dist":{"shasum":"84dbc660fab8f294031bc77118806bda020bbbda","tarball":"https://registry.npmjs.org/detect-pointer-events/-/detect-pointer-events-1.0.0.tgz","integrity":"sha512-XpTaSghoJDtDczDXMvTaNX1oXpfsIXgwPGuQSLBOy1h/S8MpVJePZfcGA9VnybmwGRrVXDZD9nD0bGtt94OAag==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGW6vACp8RnByd11ZAWV+5hPVHgKdhTBOsiwQBhZqQF/AiBZR/ZTwUBqA/5PZ97s02EhGLFySMJgJ1HtPK2OGhyYGQ=="}]},"maintainers":[{"name":"rafrex","email":"code@rafrex.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/detect-pointer-events-1.0.0.tgz_1469143061373_0.9019548564683646"},"directories":{}},"1.0.1":{"name":"detect-pointer-events","version":"1.0.1","description":"Detect if the browser supports the pointer events api","main":"lib/index.js","scripts":{"build":"rm -rf lib && babel src --presets babel-preset-es2015 -d lib","prepublish":"npm run build"},"files":["lib","src"],"repository":{"type":"git","url":"git+https://github.com/rafrex/detect-pointer-events.git"},"keywords":["detect","pointer events","pointer","touch"],"author":{"name":"Rafael Pedicini","email":"code@rafrex.com"},"license":"MIT","bugs":{"url":"https://github.com/rafrex/detect-pointer-events/issues"},"homepage":"https://github.com/rafrex/detect-pointer-events#readme","devDependencies":{"babel-cli":"^6.10.1","babel-preset-es2015":"^6.9.0","eslint":"^3.0.1","eslint-config-airbnb-base":"^4.0.0","eslint-plugin-import":"^1.10.2"},"gitHead":"67baecfcd8d8130ff079c280c6f61d0a92585bac","_id":"detect-pointer-events@1.0.1","_shasum":"231f225f03ba9424149daa5999d6cfcd431e64ae","_from":".","_npmVersion":"3.10.7","_nodeVersion":"6.2.0","_npmUser":{"name":"rafrex","email":"code@rafrex.com"},"dist":{"shasum":"231f225f03ba9424149daa5999d6cfcd431e64ae","tarball":"https://registry.npmjs.org/detect-pointer-events/-/detect-pointer-events-1.0.1.tgz","integrity":"sha512-Y2rWAnVsnzfWKN2SBMdlm/lQohI7ldfZXSFvQ7Gv32gWt7OCn9UO9/UgUhbQYRIzVrllzmcLIJFQlr7T3u99Tg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDcxOAWeZFizE75XHren6WZnuAeORXK4FfQNbPu3twFYgIgGivRI24Yp61QRGyaOAFSpCbDvyBIH1p6UPH9rxPNsyo="}]},"maintainers":[{"name":"rafrex","email":"code@rafrex.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/detect-pointer-events-1.0.1.tgz_1479153933384_0.5753940856084228"},"directories":{}},"1.0.2":{"name":"detect-pointer-events","version":"1.0.2","description":"Detect if the browser supports the pointer events api","main":"lib/index.js","scripts":{"build":"rm -rf lib && babel src --presets babel-preset-es2015 -d lib","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/rafgraph/detect-pointer-events.git"},"keywords":["detect","pointer events","pointer","touch"],"author":{"name":"Rafael Pedicini","email":"rafael@rafgraph.dev"},"license":"MIT","bugs":{"url":"https://github.com/rafgraph/detect-pointer-events/issues"},"homepage":"https://github.com/rafgraph/detect-pointer-events#readme","devDependencies":{"babel-cli":"^6.10.1","babel-preset-es2015":"^6.9.0","eslint":"^3.0.1","eslint-config-airbnb-base":"^4.0.0","eslint-plugin-import":"^1.10.2"},"gitHead":"e18942e17de0a4064db7dea4186730b33bb51754","_id":"detect-pointer-events@1.0.2","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-yf04kXITjVuIiurhU9g9Xt3tvnQG3/vPHZmeHSRpST/1p0KkDRupGHOM1emX3DoRl6nMIXAy+7zgaYuC59231g==","shasum":"0e3ad58611d63ff40b6fff0ec5ac5e8735dfbda4","tarball":"https://registry.npmjs.org/detect-pointer-events/-/detect-pointer-events-1.0.2.tgz","fileCount":5,"unpackedSize":10094,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWm+cCRA9TVsSAnZWagAAd6YP/i87IuRong8AQvAGVuCW\n64r/5UUHa4w6Yn1uE/iDYtfoMnEyDv6hk/MKURdMVurUtR9RvwKce3KLKIKJ\ndSVxs7mT5wsVbOz0eHN3aXxsATaa8l7HIspUNbb6rzDov8nkuPvp7LM0v7V+\n+0CanaffT2N0ox0GhjMsCXjA2IwD/lyIMOSHu1A0c/m6Ztws1PH/PM1CPcWV\n9LBhbbBSXy5UZqt/VjRYNJLKyLz4ZCf+9fldEY5YccoAbhgmiLwqqdK64I7D\nQWnQvuTmoekv8chc75Kw3RL0ejHtOeZMgXCZE+FWq6uZT7NIcyR1rOyopqvG\nMD8PjzxDEcuIpZeP2b/skaLLw+R1BddbPCAC2nPn6cA3e+EzPhLIInNIjCpC\n4bcB8vn8K6VSPM46zxmxIczA7ZgXzI3ccynFaQ0UK+6giyKpMJQueiXeADmr\n3Z5PD7Dm1Qmxlab2fx3yiCFt6UUBKdHLmFC3WUk9cwxcV0LSXbuwmYgA/ovW\npCR7QJdPFARbg7D+U0NKWS8JTGkmZ0WmUegjHCCglY3q5EpfQYICPUIOi9jT\n0dQj/8f6HQGCAyapBkaBb9tlHOkR4y9LBzcWcLk7KQlqicTb0CVY5Fx9DkUe\nDLO85rGsU9C8am9udKpfqhfgLCk3K3A54FuPt0qEojI6jMu61JQwkMCA29mA\nhFxn\r\n=Vdy3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDnySEZWhh55aC+WHep7yEEcHwfUuOsa5EfXLr/GsjRTgIhAJS/E3WxNpMcYzVk6VRpia+k5nVaDPt8D9+dwaXdEKTJ"}]},"maintainers":[{"name":"rafgraph","email":"rafael@rafgraph.dev"}],"_npmUser":{"name":"rafgraph","email":"rafael@rafgraph.dev"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-pointer-events_1.0.2_1599762331196_0.8388614314202743"},"_hasShrinkwrap":false}},"readme":"# Detect Pointer Events\n\nDetect if the browser supports the pointer events api.\n\n[Live detection test][liveDetectionTest]\n\nExports a reference to a singleton object (a micro state machine with an update function) with its state set to if the browser supports the pointer events api, (and if so does the api require a prefix, is it running on a touch device, and how many touch points does the device have), as well as an `update()` function which re-runs the tests and updates the object's state. There is also a `prefix(value)` function which will return the `value` and only add a prefix to it if it's required.\n\nNote that `detect-pointer-events` is one of the micro state machines used by [`detect-it`][detectItRepo] to determine if a device is `mouseOnly`, `touchOnly`, or `hybrid`.\n\n*For more information on the pointer events api, please see [MDN's Pointer Events][mdnPointerEvents], or the [W3C Pointer Events specification][w3cSpecLatest].*\n\n\n### `detectPointerEvents` micro state machine\n```javascript\nconst detectPointerEvents = {\n  hasApi: boolean,\n  requiresPrefix: boolean,\n  hasTouch: boolean,\n  maxTouchPoints: whole number,\n\n  // re-run all the detection tests and update state\n  update() {...},\n\n  // prefix the passed in value only if requiresPrefix === true\n  prefix(value) {...},\n}\n```\n\n### Installing `detect-pointer-events`\n```terminal\n$ npm install detect-pointer-events\n```\n\n### Using `detect-pointer-events`\n```javascript\nimport detectPointerEvents from 'detect-pointer-events';\n```\n```javascript\n// using the state\ndetectPointerEvents.hasApi === true; // pointer events api is present in the browser\ndetectPointerEvents.requiresPrefix === true; // use of pointer events requires the Microsoft prefix\ndetectPointerEvents.hasTouch === true; // pointer events running on a touch capable device\ndetectPointerEvents.maxTouchPoints; // maximum number of touch points supported by the device\n\n// updating the state - most apps won't need to use this at all\ndetectPointerEvents.update();\n\n// prefixing pointer events\ndetectPointerEvents.prefix(value) // returns the value and only adds the prefix if requiresPrefix\n\n// for example, this will add an event listener for 'MSPointerDown' if requiresPrefix === true,\n// otherwise it will add an event listener for 'pointerdown'\nelement.addEventListener(detectPointerEvents.prefix('pointerdown'), function...)\n```\n\n```javascript\n/*\n * note that in the case of a browser that doesn't support pointer events,\n * including when using a legacy computer and browser, the default state will be:\n */\nconst detectPointerEvents = {\n  hasApi: false,\n  requiresPrefix: undefined,\n  hasTouch: undefined,\n  maxTouchPoints: undefined,\n}\n```\n\nFor reference, here is the [pointer events prefix map][prefixMap] used by the `prefix()` function.\n\nNote that the `update()` function is run once at the time of import to set the object's initial state, and generally doesn't need to be run again. If it doesn't have access to the `window`, then the state will be `undefined` (`detect-pointer-events` will not throw an error), and you will have to call the `update()` function manually at a later time to update its state.\n\n\n### Part of the [`detect-it`][detectItRepo] family\n- [`detect-it`][detectItRepo]\n  - [`detect-hover`][detectHoverRepo]\n  - [`detect-pointer`][detectPointerRepo]\n  - [`detect-touch-events`][detectTouchEventsRepo]\n  - **`detect-pointer-events`**\n  - [`detect-passive-events`][detectPassiveEventsRepo]\n\n\n<!-- links -->\n[liveDetectionTest]: https://detect-it-v1.rafgraph.dev/#detect-pointer-events\n[w3cSpecLatest]: https://www.w3.org/TR/pointerevents/\n[mdnPointerEvents]: https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events\n[prefixMap]: https://github.com/rafgraph/detect-pointer-events/blob/main/src/index.js#L1\n[detectItRepo]: https://github.com/rafgraph/detect-it/tree/v1.1.0\n[detectHoverRepo]: https://github.com/rafgraph/detect-hover\n[detectPointerRepo]: https://github.com/rafgraph/detect-pointer\n[detectTouchEventsRepo]: https://github.com/rafgraph/detect-touch-events\n[detectPassiveEventsRepo]: https://github.com/rafgraph/detect-passive-events\n","maintainers":[{"name":"rafgraph","email":"rafael@rafgraph.dev"}],"time":{"modified":"2022-06-15T01:58:10.987Z","created":"2016-07-07T03:20:42.666Z","0.1.0":"2016-07-07T03:20:42.666Z","0.1.1":"2016-07-08T04:24:31.756Z","1.0.0":"2016-07-21T23:17:43.120Z","1.0.1":"2016-11-14T20:05:33.606Z","1.0.2":"2020-09-10T18:25:31.283Z"},"homepage":"https://github.com/rafgraph/detect-pointer-events#readme","keywords":["detect","pointer events","pointer","touch"],"repository":{"type":"git","url":"git+https://github.com/rafgraph/detect-pointer-events.git"},"author":{"name":"Rafael Pedicini","email":"rafael@rafgraph.dev"},"bugs":{"url":"https://github.com/rafgraph/detect-pointer-events/issues"},"license":"MIT","readmeFilename":"README.md"}