{"id":21050953,"url":"https://github.com/theopenwebjp/js-sensor","last_synced_at":"2025-09-16T12:22:54.061Z","repository":{"id":40800408,"uuid":"113573495","full_name":"theopenwebjp/js-sensor","owner":"theopenwebjp","description":"JavaScript sensor library for native input sensors.","archived":false,"fork":false,"pushed_at":"2023-07-23T07:33:33.000Z","size":1102,"stargazers_count":5,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T08:06:33.678Z","etag":null,"topics":["accelerometer","geolocation","gyrosensor","html5","javascript","js","sensor"],"latest_commit_sha":null,"homepage":"https://theopenweb.info/app/js-sensor/example/index.html","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/theopenwebjp.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,"governance":null}},"created_at":"2017-12-08T12:44:08.000Z","updated_at":"2024-08-27T13:18:22.000Z","dependencies_parsed_at":"2023-11-15T06:46:05.787Z","dependency_job_id":null,"html_url":"https://github.com/theopenwebjp/js-sensor","commit_stats":{"total_commits":28,"total_committers":3,"mean_commits":9.333333333333334,"dds":0.4285714285714286,"last_synced_commit":"145b9e626683ccc75face8b25a539c3bb17246e3"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopenwebjp%2Fjs-sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopenwebjp%2Fjs-sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopenwebjp%2Fjs-sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopenwebjp%2Fjs-sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theopenwebjp","download_url":"https://codeload.github.com/theopenwebjp/js-sensor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254425593,"owners_count":22069201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["accelerometer","geolocation","gyrosensor","html5","javascript","js","sensor"],"created_at":"2024-11-19T15:48:51.386Z","updated_at":"2025-09-16T12:22:49.005Z","avatar_url":"https://github.com/theopenwebjp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JS Sensor\r\n\r\nSensor watcher of JavaScript sensor events.\r\nThis module is designed to have only basic functionality.\r\nAny more complex functionality should be achieved through extending this module.\r\n\r\n## Environment\r\n\r\nShould work and be extensible using any new JavaScript environment(node, browser).\r\nDefault event listeners provided via browser-sensor-watcher.\r\nPossible to use own via extension.\r\n\r\nCurrently uses Common JS due to not being limited to use on browser.\r\nCan load via Common JS require OR by loading pre-built /dist/bundle.js.\r\n\r\n## Build\r\n\r\nIf building from source is desired OR the latest dist is not provided, building can by done via `npm run build-all`\r\n\r\n## Installation\r\n\r\n1. Install node(including npm)\r\n2. \"npm install\" in base directory\r\n\r\n## Usage\r\n\r\nThe full api can be checked from the documentation. See \"Documentation\" below.\r\n\r\nBasic usage can be seen below:\r\n\r\n ```javascript\r\n const jsSensor = new require('js-sensor');\r\n // OR Load via script element: \u003cscript src=\"js-sensor/dist/bundle.js\"\u003e\u003c/script\u003e\r\n\r\n // Get sensor list\r\n console.log('names:' jsSensor.getMappedSensorNames());\r\n\r\n // Update/extend\r\n jsSensor.updateSensorListeners((sensorListenerMap)=\u003e{\r\n     sensorListenerMap['myListener'] = {\r\n         start: (options)=\u003e{\r\n             const data = '...HANDLE HERE';\r\n             options.events.data(data);\r\n         },\r\n         stop: ()=\u003e{\r\n             // STOP\r\n         },\r\n         check: ()=\u003e{\r\n             // CHECK FOR AVAILABILITY\r\n             return true;\r\n         }\r\n     };\r\n     return sensorListenerMap;\r\n });\r\n\r\n // Get\r\n jsSensor.get('deviceMotion')\r\n .then((data)=\u003e{\r\n     console.log('get', data);\r\n });\r\n\r\n // Watch\r\n jsSensor.watch('deviceOrientation',\r\n {\r\n     events: {\r\n         data: (data)=\u003e{\r\n             console.log('watch', data);\r\n         }\r\n     }\r\n });\r\n\r\n // Stop\r\n jsSensor.stop('deviceOrientation);\r\n\r\n // WatchAll\r\n jsSensor.watchAll();\r\n // ...wait a while\r\n // StopAll\r\n jsSensor.stopAll()\r\n ```\r\n\r\n## Events\r\n\r\n* watchPosition\r\n* getUserMedia\r\n* deviceOrientation\r\n* deviceLight\r\n* deviceProximity\r\n* deviceMotion\r\n* test\r\n\r\n## Tests\r\n\r\nRun `npm run test`\r\n\r\n## Reports\r\n\r\n* Built when running tests.\r\n* Eslint\r\n\r\n## Documentation\r\n\r\n* Esdoc(./docs/)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheopenwebjp%2Fjs-sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheopenwebjp%2Fjs-sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheopenwebjp%2Fjs-sensor/lists"}