{"id":13549486,"url":"https://github.com/remy/track","last_synced_at":"2026-03-05T09:32:19.328Z","repository":{"id":2093392,"uuid":"3033770","full_name":"remy/track","owner":"remy","description":"Interaction tracker library (mouse, touch, keyboard)","archived":false,"fork":false,"pushed_at":"2012-01-01T23:47:00.000Z","size":94,"stargazers_count":42,"open_issues_count":0,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-04T20:45:17.558Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://remy.github.com/track/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-22T12:42:58.000Z","updated_at":"2024-11-20T15:50:18.000Z","dependencies_parsed_at":"2022-07-22T20:22:58.560Z","dependency_job_id":null,"html_url":"https://github.com/remy/track","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/remy/track","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Ftrack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Ftrack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Ftrack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Ftrack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remy","download_url":"https://codeload.github.com/remy/track/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Ftrack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30117698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T08:19:04.902Z","status":"ssl_error","status_checked_at":"2026-03-05T08:17:37.148Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-08-01T12:01:22.336Z","updated_at":"2026-03-05T09:32:19.308Z","avatar_url":"https://github.com/remy.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Usage\n\n## Track the entire document\n\n```javascript\nvar track = new Track();\ndocument.addEventListener(track.up, function () {\n  alert('You held down for ' + track.duration + 'ms');\n}, false);\n```\n\n# API\n\n* `new Track(\u003ccontext\u003e)` - defaults to the `document` returns a new track object which contains live information about the position of cursor\n\n## Mouse \u0026 Touch based information\n\nNote that all x/y coordinates are relative to the context passed in to the `Track` object. If you want the x/y relative to the screen, set the context to the document.\n\n* `track.touch` - boolean to indicate touch event support\n* `track.x`, `track.x` - last knowning x/y corrdinates - these are updated on any move event on the context, and are available at all times\n* `track.downX`, `track.downY` - the x/y corrdinates on the down event\n* `track.upX`, `track.upY` - the x/y corrdinates on the up event\n* `track.startTime` - the time in milliseconds when the last down event occurred\n* `track.duration` - the duration in milliseconds between the down and up event\n* `track.down` - boolean to indicate whether the cursor (or finger) is down\n\n## Event names\n\nThere are three connivence strings that allow you to easily bind to the right event type depending on whether `track.touch` is true or not. For example `track.events.up` is `mouseup` if `track.touch` is `false`, and `touchend` if `track.touch` is `true`.\n\n* `track.events.up`\n* `track.events.down`\n* `track.events.move`\n\n## Momentum\n\n* `track.weight` - an arbitrary value that affects the momentum of a move event. The lower the number, the heavier the move event and therefore the lower the momentum. Higher numbers like 1500 give a sense of the move event having momentum ([as seen in the demo](http://remy.github.com/track/))\n* `track.momentumX`, `track.momentumY` - values that must be subtracted from the `track.x`/y to get the final x/y position after momentum.\n\nFor example:\n\n```javascript\nvar track = new Track();\ndocument.addEventListener(track.events.up, function () {\n  animate({\n    start: [track.downX, track.downY],\n    end: [track.x - track.momentumX, track.y - track.momentumY]\n  });\n}, false);\n```\n\n## Keyboard\n\nAny key pressed will hold a true value whilst down with the keycode (via `event.which`):\n\nFor example:\n\n```javascript\nif (track.key[27]) {\n  // user is holding the escape key\n}\n```\n\n## Serialisation\n\nNothing special, just outputs to JSON:\n\n* `track.toString()` or `track+''` - to get the JSON respresentation of the object\n\n# License\n\nMIT-License: [http://rem.mit-license.org](http://rem.mit-license.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremy%2Ftrack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremy%2Ftrack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremy%2Ftrack/lists"}