{"id":25687129,"url":"https://github.com/holyshared/locater","last_synced_at":"2025-08-20T12:43:31.096Z","repository":{"id":1480519,"uuid":"1726016","full_name":"holyshared/Locater","owner":"holyshared","description":"Locater is an application framework using Geolocation API Specification.","archived":false,"fork":false,"pushed_at":"2011-10-25T13:35:35.000Z","size":404,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-12T13:08:51.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/holyshared.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-05-10T02:59:29.000Z","updated_at":"2014-01-24T16:20:19.000Z","dependencies_parsed_at":"2022-07-29T17:48:54.750Z","dependency_job_id":null,"html_url":"https://github.com/holyshared/Locater","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/holyshared/Locater","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FLocater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FLocater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FLocater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FLocater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holyshared","download_url":"https://codeload.github.com/holyshared/Locater/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FLocater/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271321223,"owners_count":24739472,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"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":"2025-02-24T20:08:11.496Z","updated_at":"2025-08-20T12:43:31.024Z","avatar_url":"https://github.com/holyshared.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Locater\n====================================\n\nLocater is an application framework using [Geolocation API Specification](http://dev.w3.org/geo/api/spec-source.html \"Geolocation API Specification\").  \nIt is possible to correspond from the medium scale flexibly because it is the best for the application of a large scale, and event operation type.\nThe event can control a detailed event by being able to customize and coming.\n\n![Locater](http://holyshared.github.com/Locater/img_logo.jpg \"Locater\")\n\nHow to use\n------------------------------------------------------------------------\n\n### Step1 The handler's making\n\nHands used by the application are made in the beginning. \nThe event handler mounts the processing of the event that it wants to handle the event with the object. \nPlease make it as much as possible though it is unquestionable for the error hands even if it doesn't make it. \n\n#### Hanlder Example\n\n\t#js\n\tvar myHanlder = new Locater.Handler.SimpleHandler({\n\t\tcurrentWatched: function(context){\n\t\t\t//do something\n\t\t}\n\t});\n\n\tvar errorHanlder = new Locater.Handler.SimpleHandler({\n\t\terror: function(error){\n\t\t\talert(error.message);\n\t\t}\n\t});\n\nThe event that the event can be handled is as follows.\n\n#### Hanlder Events\n\n##### Position\n\nA positional event takes a present position in the argument.\n\n* **currentWatched** - When the coordinates position is acquired, it is generated only once most first.\n* **positionChanged** - When latitude and the longitude change, it is generated.\n* **latitudeChanged** - When latitude changes, it is generated. \n* **longitudeChanged** - When longitude changes, it is generated. \n* **altitudeChanged** - When altitude changes, it is generated.\n* **accuracyChanged** - When accuracy changes, it is generated.\n* **altitudeAccuracyChanged** - When altitudeAccuracy changes, it is generated.\n* **headingChanged** - When heading changes, it is generated.\n* **speedChanged** - When speed changes, it is generated.\n\n##### Application\n\nThe application event is an event related to the application. \nThere is no argument.\n\n* **start** - When the application is begun, it is generated.\n* **stop** - When the application is stopped, it is generated.\n\n##### Error\n\nIt is an event when the error originates while executing it.\nThe argument is [PositionError](http://dev.w3.org/geo/api/spec-source.html#position_error_interface \"PositionError\").\n\n* **error** - When the error occurs, it is generated. \n\n\n### Step2 Making of adaptor\n\nNext, the adaptor used by the application is made. \nThe adaptor has **CurrentPositionAdapter** to acquire present coordinates position and **WacthPositionAdapter** to acquire the coordinates position regularly.\n\nThe method of generating the adaptor becomes as follows. \nMoreover, the option of the adaptor is the same as [PositionOptions](http://dev.w3.org/geo/api/spec-source.html#position_options_interface \"PositionOptions\").\n\n#### CurrentPositionAdapter\n\n\t#js\n\tvar options = { enableHighAccuracy: true };\n\tvar adapter = new Locater.Adapter.CurrentPositionAdapter(options);\n\n#### WacthPositionAdapter\n\n\t#js\n\tvar options = { enableHighAccuracy: true };\n\tvar adapter = new Locater.Adapter.CurrentPositionAdapter(options);\n\n\n### Step3 Making of application\n\nThe adaptor and the option are handed over to the constructor of the application. \nThe handler is registered by using the **addHandler** method at the end, and the application is executed by the **run** method. \n\nA final code is as follows. \n\n\t#js\n\t(function(){\n\t\t//Alias\n\t\tvar Application = Locater.Application;\n\t\tvar Adapter = Locater.Adapter;\n\t\tvar Handler = Locater.Handler;\n\n\t\t//Handlers\n\t\tvar myHanlder = new Handler.SimpleHandler({\n\t\t\tcurrentWatched: function(context){\n\t\t\t\t//do something\n\t\t\t\t/*\n\t\t\t\t\t//Context methods\n\t\t\t\t\tcontext.getLatitude();\n\t\t\t\t\tcontext.getLongitude();\n\t\t\t\t\tcontext.getAltitude();\n\t\t\t\t\tcontext.getAccuracy();\n\t\t\t\t\tcontext.getAltitudeAccuracy();\n\t\t\t\t\tcontext.getHeading();\n\t\t\t\t\tcontext.getSpeed();\n\t\t\t\t*/\n\t\t\t}\n\t\t});\n\n\t\tvar errorHanlder = new Handler.SimpleHandler({\n\t\t\terror: function(error){\n\t\t\t\talert(error.message);\n\t\t\t}\n\t\t});\n\n\t\twindow.addEvent('domready', function(){\n\n\t\t\tvar adapter = new Adapter.CurrentPositionAdapter();\n\t\t\tvar app = new Application(adapter);\n\t\t\tapp.addHandler(myHanlder);\n\t\t\tapp.addHandler(errorHanlder);\n\t\t\tapp.run();\n\n\t\t});\n\t}());\n\n\nThe definition of a custom-made rule\n------------------------------------------------------------------------\n\nThe following example defines the custom-made event when latitude longitude turns up rather than Tokyo.  \nThe definition of a custom-made event has the method of defining functionally, and the method of specifying by an object.  \nAn event name can be decided freely.  \n\n### When a definition is given function \n\n\tLocater.Rules.define('fooEvent', function(current, wacth){\n\t\t//In the first stage, the position of current is null. \n\t\t//It can be referred to now from the 2nd time or subsequent ones.\n\t\tif (current == null) return false;\n\n\t\t//A custom-made event when latitude longitude turns up rather than Tokyo\n\t\tif (wacth.getLatitude() \u003e 35.4122 \u0026\u0026 wacth.getLatitude() \u003e 139.4130){\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t});\n\n### When defining by an object\n\n\tvar custumRule = {\n\t\tinvoke: function(current, wacth){\n\t\t\t//In the first stage, the position of current is null. \n\t\t\t//It can be referred to now from the 2nd time or subsequent ones.\n\t\t\tif (current == null) return false;\n\t\n\t\t\t//A custom-made event when latitude longitude turns up rather than Tokyo\n\t\t\tif (wacth.getLatitude() \u003e 35.4122 \u0026\u0026 wacth.getLatitude() \u003e 139.4130){\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t};\n\tLocater.Rules.define('fooEvent', custumRule);\n\n\n### Mounting of event handler\n\nThe rest only mounts processing at the time of an event occurring in an event hair drier.  \nSince **fooEvent** defined the event name, it mounts in an event hair drier by a key called **fooEvent**.\n\n\t(function(){\n\t\t//Alias\n\t\tvar Application = Locater.Application;\n\t\tvar Adapter = Locater.Adapter;\n\t\tvar Handler = Locater.Handler;\n\n\t\t//Handlers\n\t\tvar myHanlder = new Handler.SimpleHandler({\n\t\t\tfooEvent: function(context){\n\t\t\t\t//do something\n\t\t\t}\n\t\t});\n\n\t\twindow.addEvent('domready', function(){\n\n\t\t\tvar adapter = new Adapter.CurrentPositionAdapter();\n\t\t\tvar app = new Application(adapter);\n\t\t\tapp.addHandler(myHanlder);\n\t\t\tapp.run();\n\n\t\t});\n\t}());\n\n\n\nUse of an inclusion rule \n------------------------------------------------------------------------\n\nThere are **Locater.Rules.MileRule** and **Locater.Rules.KilometerRule** which can define the custom-made event performed whenever a fixed distance separates in Locator.  \nThere is the following feature, respectively. \n\n* Locater.Rules.MileRule - The mileage specified by coordinates can define the event performed whenever it gets used.\n* Locater.Rules.KilometerRule - The number of kilometers specified by coordinates can define the event performed whenever it gets used.\n\n### The definition method of a rule \n\n\t//Whenever it gets used, 1 mile of fiveKilometerOvered events of an event hair drier are performed.\n\tLocater.Rules.define('oneMileOvered', new Locater.Rules.MileRule(1));\n\n\t//Whenever it gets used, 5 km of fiveKilometerOvered events of an event hair drier are performed.\n\tLocater.Rules.define('fiveKilometerOvered', new Locater.Rules.KilometerRule(5));\n\n\nThe test which uses an emulator \n------------------------------------------------------------------------\n\nAn emulator can be used for the test of application.  \nIn an emulator, a coordinates position can be specified instead of using [Geolocation API](http://dev.w3.org/geo/api/spec-source.html \"Geolocation API\").  \nThat is, it is possible to specify and test test data freely.\n\n### Locater.Emulator.CurrentPositionEmulator\n\nCurrentPositionEmulator enables the test of the application which uses CurrentPositionAdaptor.  \nThe actual example of use specifies an emulator as a change of an adapter as follows.  \n\n\t(function(){\n\t\t//Alias\n\t\tvar Application = Locater.Application,\n\t\t\tEmulator = Locater.Emulator,\n\t\t\tHandler = Locater.Handler;\n\n\t\t//Handlers\n\t\tvar myHanlder = new Handler.SimpleHandler({\n\t\t\tcurrentWatched: function(context){\n\t\t\t\talert(context.getLatitude()); //Alert 37\n\t\t\t\talert(context.getLongitude()); //Alert -122\n\t\t\t}\n\t\t});\n\n\t\twindow.addEvent('domready', function(){\n\t\t\tvar emulator = new Emulator.CurrentPositionEmulator({\n\t\t\t\tpotistion: {\n\t\t\t\t\tcoords: {\n\t\t\t\t\t\tlatitude: 37,\n\t\t\t\t\t\tlongitude: -122\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tvar app = new Application(emulator);\n\t\t\tapp.addHandler(myHanlder);\n\t\t\tapp.run();\n\n\t\t});\n\t}());\n\n\n### Locater.Emulator.WatchPositionEmulator\n\nWatchPositionEmulator enables the test of the application which uses WatchPositionAdaptor.  \nThe actual example of use specifies an emulator as a change of an adapter as follows.  \nThe interval processed as the **interval option** can be specified.  \n\n\t(function(){\n\t\t//Alias\n\t\tvar Application = Locater.Application,\n\t\t\tEmulator = Locater.Emulator,\n\t\t\tHandler = Locater.Handler;\n\n\t\t//Handlers\n\t\tvar myHanlder = new Handler.SimpleHandler({\n\t\t\tcurrentWatched: function(context){\n\t\t\t\talert(context.getLatitude()); //Alert 37\n\t\t\t\talert(context.getLongitude()); //Alert -122\n\t\t\t},\n\t\t\tpositionChanged: function(context){\n\t\t\t\talert(context.getLatitude()); //Alert 36, 35 ....\n\t\t\t\talert(context.getLongitude()); //Alert -123, 124 ....\n\t\t\t}\n\t\t});\n\n\t\twindow.addEvent('domready', function(){\n\n\t\t\tvar emulator = new Emulator.WatchPositionEmulator({\n\t\t\t\tinterval: 2000,\n\t\t\t\tpositions: [\n\t\t\t\t\t{ coords: { latitude: 37, longitude: -122 } },\n\t\t\t\t\t{ coords: { latitude: 36, longitude: -123 } },\n\t\t\t\t\t{ coords: { latitude: 35, longitude: -124 } }\n\t\t\t\t]\n\t\t\t});\n\t\t\tvar app = new Application(emulator);\n\t\t\tapp.addHandler(myHanlder);\n\t\t\tapp.run();\n\n\t\t});\n\t}());\n\n\nRequired libraries\n------------------------------------------------------------------------\n\n### Mootools Core\nhttp://mootools.net/core/3db61bb25aa2a339b7aee42f4d7bad03\n\n\nBuilding Locater\n------------------------------------------------------------------------\n\n### All components\npackager build Locater/* +use-only Locater \u003e locater-full.js\n\n### Application which acquires a coordinates position only once\n\npackager build Locater/Locater.Application Locater/Locater.Adapter.CurrentPositionAdapter +use-only Locater \u003e locater-current-position.js  \npackager build Locater/Locater.Application Locater/Locater.Emulator.CurrentPositionEmulator +use-only Locater \u003e locater-current-position-dev.js\n\n### Application which acquires a coordinates position periodically\n\npackager build Locater/Locater.Application Locater/Locater.Adapter.WatchPositionAdapter +use-only Locater \u003e locater-watch-position.js  \npackager build Locater/Locater.Application Locater/Locater.Emulator.WatchPositionEmulator +use-only Locater \u003e locater-watch-position-dev.js \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholyshared%2Flocater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholyshared%2Flocater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholyshared%2Flocater/lists"}