{"id":13744862,"url":"https://github.com/jeremyruppel/as3-router","last_synced_at":"2026-01-06T03:03:21.513Z","repository":{"id":1288419,"uuid":"1228299","full_name":"jeremyruppel/as3-router","owner":"jeremyruppel","description":"Simple hash-router for ActionScript 3","archived":false,"fork":false,"pushed_at":"2015-11-09T18:29:02.000Z","size":6664,"stargazers_count":42,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T22:18:50.551Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"ActionScript","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/jeremyruppel.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":"2011-01-07T01:48:26.000Z","updated_at":"2021-12-17T15:33:17.000Z","dependencies_parsed_at":"2022-08-16T12:55:20.635Z","dependency_job_id":null,"html_url":"https://github.com/jeremyruppel/as3-router","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyruppel%2Fas3-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyruppel%2Fas3-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyruppel%2Fas3-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyruppel%2Fas3-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeremyruppel","download_url":"https://codeload.github.com/jeremyruppel/as3-router/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245128130,"owners_count":20565206,"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":[],"created_at":"2024-08-03T05:01:17.464Z","updated_at":"2026-01-06T03:03:16.494Z","avatar_url":"https://github.com/jeremyruppel.png","language":"ActionScript","funding_links":[],"categories":["Unsorted"],"sub_categories":["Other API"],"readme":"AS3 Router\n==========\n\n**as3-router** is a simple hash and query string router for ActionScript 3\nthat maps route strings to events. This project was inspired by the simplicity\nof routing by frameworks like [Sinatra][Sinatra] and [Backbone][Backbone].\n\nThe router does not hook into any specific deep-linking solution (though if\nyou're looking for one, I'd strongly recommend [SWFAddress][SWFAddress]).\nIt simply takes a string route and interprets it into an event, including\nroute information and parameters.\n\nAlso, it should be noted that the router works extremely well with [RobotLegs][RobotLegs],\nthough there are absolutely no dependencies on it.\n\nUsage Overview\n--------------\n\nA router can be instantiated stand-alone and can route events through its\n`eventDispatcher` accessor.\n\n\tvar router : IRouter = new Router( );\n\t\n\trouter.mapRoute( '/hello/:name', CustomRouteEvent.HELLO );\n\t\n\trouter.eventDispatcher.addEventListener( CustomRouteEvent.HELLO, function( event : RouteEvent ) : void\n\t{\n\t\tevent.route.value; // =\u003e '/hello/awesome'\n\t\t\n\t\tevent.route.params( 'name' ); // =\u003e awesome\n\t} );\n\t\n\t// later on...\n\trouter.route( '/hello/awesome' );\n\nThe base `Router` class may optionally accept an `IEventDispatcher` implementation\nto dispatch events from. This makes it trivial to integrate into a RobotLegs\ncontext, like:\n\n\tvar router : IRouter = new Router( eventDispatcher );\n\t\n\trouter.mapRoute( '/hello/:name', CustomRouteEvent.HELLO );\n\t\n\tcommandMap.mapEvent( CustomRouteEvent.HELLO, SayHelloToSomeoneCommand );\n\t\n\t// later on...\n\trouter.route( '/hello/awesome' );\n\nRoute Mappings\n--------------\n\nThe base Router implementation can map string routes, regex routes, and query string routes\n(represented as objects). The most typical and convenient use case should be to map string\nroutes, as they are internally converted to regex patterns with some common pattern conventions\nthat should be familiar to anyone who has experience routing with Sinatra or Backbone.\n\n`mapRoute` can accept named parameters denoted by a colon. For example:\n\n\trouter.mapRoute( '/hello/:name', CustomRouteEvent.HELLO );\n\nwill match \"/hello/world\", \"hello/friend\", \"hello/no-wait-actually-goodbye\", etc. The value of \na named parameter can be retrieved from the `route` object of the route event dispatched\nwhen this route is matched, like:\n\n\tevent.route.params( 'name' ); // =\u003e 'no-wait-actually-goodbye'\n\nMultiple parameters can be declared and will each be matched by name:\n\n\trouter.mapRoute( '/:section/:page', CustomRouteEvent.PAGE );\n\t\n\trouter.hasRoute( '/company/manifesto' ); // =\u003e true\n\t\n\t// and for the event's route...\n\tevent.route.params( 'section' ); // =\u003e 'company'\n\tevent.route.params( 'page' ); // =\u003e 'manifesto'\n\nString routes can also contain splats that will be available as unnamed captures populated in\nthe route object's `captures` array:\n\n\trouter.mapRoute( '/*/profile', CustomRouteEvent.PROFILE );\n\t\n\trouter.hasRoute( '/username/profile' ); // =\u003e true\n\t\n\trouter.hasRoute( '/username/contact' ); // =\u003e false\n\t\n\t// and for the event's route...\n\tevent.route.captures[ 0 ]; // =\u003e 'username'\n\nRoutes also receive query parameters in their params object. This can be useful for\ntweaking behavior of routes:\n\n\trouter.mapRoute( '/blog', CustomRouteEvent.BLOG );\n\t\n\trouter.route( '/blog?page=4' );\n\t\n\t// and for the event's route...\n\tevent.route.params( 'page' ); // =\u003e '4'\n\n`mapQuery` can match query-string-style routes if you need them. Because query strings are\nunordered key value pairs, they are matched as simple objects, like:\n\n\trouter.mapQuery( { page : 'home', action : 'whatever' }, CustomRouteEvent.HOME );\n\t\n\trouter.route( '?action=whatever\u0026page=home' );\n\t\n\t// and for the event's route...\n\tevent.route.params( 'action' ); // =\u003e 'whatever'\n\tevent.route.params( 'page' ); // =\u003e 'home'\n\nUnmapped Routes\n---------------\n\nIf no route is matched through a call to `route`, a `RouteEvent.NOT_FOUND` event will\nbe dispatched from the router's eventDispatcher.\n\n[Sinatra]: http://www.sinatrarb.com/ \"Sinatra\"\n[Backbone]: http://documentcloud.github.com/backbone/ \"Backbone.js\"\n[SWFAddress]: http://www.asual.com/swfaddress/ \"SWFAddress\"\n[RobotLegs]: https://github.com/robotlegs/robotlegs-framework \"RobotLegs\"","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremyruppel%2Fas3-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeremyruppel%2Fas3-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremyruppel%2Fas3-router/lists"}