{"id":19533945,"url":"https://github.com/rafgraph/detect-pointer","last_synced_at":"2026-06-19T10:31:33.876Z","repository":{"id":60774780,"uuid":"62690669","full_name":"rafgraph/detect-pointer","owner":"rafgraph","description":"JavaScript wrapper for pointer and any-pointer media queries","archived":false,"fork":false,"pushed_at":"2020-09-12T00:47:52.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-24T05:18:46.947Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://detect-it.rafgraph.dev#detect-pointer","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rafgraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-06T04:19:24.000Z","updated_at":"2023-03-09T01:40:39.000Z","dependencies_parsed_at":"2022-10-04T16:15:58.412Z","dependency_job_id":null,"html_url":"https://github.com/rafgraph/detect-pointer","commit_stats":null,"previous_names":["rafrex/detect-pointer"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/rafgraph/detect-pointer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafgraph%2Fdetect-pointer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafgraph%2Fdetect-pointer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafgraph%2Fdetect-pointer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafgraph%2Fdetect-pointer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rafgraph","download_url":"https://codeload.github.com/rafgraph/detect-pointer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafgraph%2Fdetect-pointer/sbom","scorecard":{"id":758579,"data":{"date":"2025-08-11","repo":{"name":"github.com/rafgraph/detect-pointer","commit":"17cd00136c1bfdb7e6ae5fcc4d54321c55a2db6c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"20 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T22:32:58.496Z","repository_id":60774780,"created_at":"2025-08-22T22:32:58.497Z","updated_at":"2025-08-22T22:32:58.497Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34528134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T02:11:16.331Z","updated_at":"2026-06-19T10:31:33.856Z","avatar_url":"https://github.com/rafgraph.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Detect Pointer\n\nJavaScript wrapper for `pointer` and `any-pointer` media queries.\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 the results of the `pointer` and `any-pointer` media queries, as well as an `update()` function which re-runs the tests and updates the object's state.\n\nNote that `detect-pointer` 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` and `any-pointer` media queries, please see the [W3C Media Queries Level 4 specification][w3cSpecLatest]. For information on browser compatibility, please see [Can I Use matchMedia][canIUseMatchMedia].*\n\n\n### `detectPointer` micro state machine\n```javascript\nconst detectPointer = {\n  // mutually exclusive (only one will be true)\n  fine: boolean,\n  coarse: boolean,\n  none: boolean,\n\n  // not mutually exclusive\n  anyFine: boolean,\n  anyCoarse: boolean,\n  anyNone: boolean,\n\n  // re-run all the detection tests and update state\n  update() {...},\n}\n```\n\n### Installing `detect-pointer`\n```terminal\n$ npm install detect-pointer\n```\n\n### Using `detect-pointer`\n```javascript\nimport detectPointer from 'detect-pointer';\n```\n```javascript\n// using the state\ndetectPointer.fine === true; // primary pointing device is accurate (e.g. mouse, stylus)\ndetectPointer.coarse === true; // primary pointing device has limited accuracy (e.g. touch, motion)\ndetectPointer.none === true; // primary input mechanism does not include a pointing device\n\n/*\n * identical to the pointer media feature, but they correspond to the\n * union of capabilities of all the pointing devices available to the user -\n * more than one of their values can be true, if different input mechanisms have\n * different characteristics\n */\ndetectPointer.anyFine === true;\ndetectPointer.anyCoarse === true;\ndetectPointer.anyNone === true;\n\n\n// updating the state - most apps won't need to use this at all\ndetectPointer.update();\n```\n\n```javascript\n/*\n * note that in the case of a legacy computer and browser, one that\n * doesn't support detect-pointer's detection tests, the default state will be:\n */\nconst detectPointer = {\n  fine: undefined,\n  coarse: undefined,\n  none: undefined,\n  anyFine: undefined,\n  anyCoarse: undefined,\n  anyNone: undefined,\n}\n```\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` or the browser doesn't support the `matchMedia()` function (all modern browser do), then the state will be `undefined` (`detect-pointer` will not throw an error). If `detect-pointer` doesn't have access to the `window` at the time of import, you will have to call the `update()` function manually at a later time to update its state.\n\n### Part of the [`detect-it`][detectItRepo] family\n- [`detect-it`][detectItRepo]\n  - [`detect-hover`][detectHoverRepo]\n  - **`detect-pointer`**\n  - [`detect-touch-events`][detectTouchEventsRepo]\n  - [`detect-passive-events`][detectPassiveEventsRepo]\n\n\n\u003c!-- links --\u003e\n[liveDetectionTest]: https://detect-it.rafgraph.dev/#detect-pointer\n[w3cSpecLatest]: https://www.w3.org/TR/mediaqueries-4/#pointer\n[canIUseMatchMedia]: https://caniuse.com/#feat=matchmedia\n[detectItRepo]: https://github.com/rafgraph/detect-it\n[detectHoverRepo]: https://github.com/rafgraph/detect-hover\n[detectTouchEventsRepo]: https://github.com/rafgraph/detect-touch-events\n[detectPassiveEventsRepo]: https://github.com/rafgraph/detect-passive-events\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafgraph%2Fdetect-pointer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafgraph%2Fdetect-pointer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafgraph%2Fdetect-pointer/lists"}