{"id":25687075,"url":"https://github.com/holyshared/urldispatcher","last_synced_at":"2025-08-12T13:05:39.512Z","repository":{"id":136708228,"uuid":"1813593","full_name":"holyshared/URLDispatcher","owner":"holyshared","description":"This library is an event dispatcher with a light URL base.","archived":false,"fork":false,"pushed_at":"2011-07-08T12:02:46.000Z","size":1112,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-31T19:28:09.239Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://sharedhat.com","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.en.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-28T09:43:17.000Z","updated_at":"2013-10-31T17:36:03.000Z","dependencies_parsed_at":"2023-03-10T22:10:53.949Z","dependency_job_id":null,"html_url":"https://github.com/holyshared/URLDispatcher","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/holyshared/URLDispatcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FURLDispatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FURLDispatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FURLDispatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FURLDispatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holyshared","download_url":"https://codeload.github.com/holyshared/URLDispatcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FURLDispatcher/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270065427,"owners_count":24520946,"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-12T02:00:09.011Z","response_time":80,"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:05.519Z","updated_at":"2025-08-12T13:05:39.479Z","avatar_url":"https://github.com/holyshared.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"URLDispatcher\n====================================\n\nThis library is an event dispatcher with a light URL base.  \nThe size of the file is 8KB very lighter.\n\n![URLDispatcher](http://holyshared.github.com/URLDispatcher/icon.png \"URLDispatcher\")\n\nHow to use\n------------------------------------------------------------------------\n\n### 1. The event handler is registered to the dispatcher.\n\nThe event handler is registered to the dispatcher.  \nThe event handler can specify the function or the object. \n\n#### javascript\n\tvar dispatcher = new URLDispatcher();\n\tdispatcher.addRoute('^/foo/$', function(context){\n\t\t//do something\n\t});\n\n\tor\n\n\tvar eventHandler = {\n\t\t//It is executed before invoke is called.\n\t\tbeforeDispatch: function(context){\n\t\t\t//do something\n\t\t},\n\n\t\texecute: function(context){\n\t\t\t//do something\n\t\t},\n\n\t\t//After invoke is called, it is executed. \n\t\tafterDispatch: function(context){\n\t\t\t//do something\n\t\t}\n\t};\n\n\tvar dispatcher = new URLDispatcher();\n\tdispatcher.addRoute('^/foo/$', eventHandler);\n\n### 2. The event is executed.\n\nThe event is executed according to arbitrary timing. \nThe data to be handed over to URL and the event handler is specified for the dispatch method.\n\nThe specified data can be referred to in **the values property** of argument context object of the event handler,  \nand the content that matches to the pattern of URL can be referred to in **the params property** of the context object.\n\n#### javascript\n\n\tvar dispatcher = new URLDispatcher();\n\tdispatcher.addRoute('^/foo/:page', function(context){\n\n\t\tvar id = context.getArg('id');\n\t\tvar page = context.getParam('page');\n\n\t\talert(page); //Alert 100\n\t\talert(id); //Alert eventDispatcher\n\n\t}, ['\\\\d+']);\n\n\tdispatcher.dispatch('/foo/100', {\n\t\tid: 'eventDispatcher'\n\t});\n\nRequired libraries\n------------------------------------------------------------------------\n\n### Mootools Core\nhttp://mootools.net/core/a2c956ca31acc228a3d0294f4b035d9a\n\nBuilding URLDispatcher\n------------------------------------------------------------------------\n\nTo do the build, the following command is specified by the packager.  \n\n#### Mootools\npackager build Core/Type Core/Object  Core/String Core/Function Core/Class +use-only Core -blocks 1.2compat\n\n#### URLDispatcher\npackager build URLDispatcher/* +use-only URLDispatcher","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholyshared%2Furldispatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholyshared%2Furldispatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholyshared%2Furldispatcher/lists"}