{"id":13743986,"url":"https://github.com/LaurentZuijdwijk/Apollo","last_synced_at":"2025-05-09T02:32:09.225Z","repository":{"id":141689375,"uuid":"2201585","full_name":"LaurentZuijdwijk/Apollo","owner":"LaurentZuijdwijk","description":"Apollo is an dependency injection and messaging framework. It can be used as the basis for Actionscript MVC projects. ","archived":true,"fork":false,"pushed_at":"2011-08-24T23:02:41.000Z","size":132,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-06T10:35:37.498Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"ActionScript","has_issues":false,"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/LaurentZuijdwijk.png","metadata":{"files":{"readme":"README.mkd","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-08-13T13:13:58.000Z","updated_at":"2023-01-28T15:24:14.000Z","dependencies_parsed_at":"2023-03-13T10:29:45.979Z","dependency_job_id":null,"html_url":"https://github.com/LaurentZuijdwijk/Apollo","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/LaurentZuijdwijk%2FApollo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurentZuijdwijk%2FApollo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurentZuijdwijk%2FApollo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurentZuijdwijk%2FApollo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LaurentZuijdwijk","download_url":"https://codeload.github.com/LaurentZuijdwijk/Apollo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213768616,"owners_count":15635822,"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:00.981Z","updated_at":"2024-08-03T05:02:54.709Z","avatar_url":"https://github.com/LaurentZuijdwijk.png","language":"ActionScript","funding_links":[],"categories":["Frameworks"],"sub_categories":["MVC Framework"],"readme":"AS3 Apollo\n==========\n\nApollo is an dependency injection and message passing framework based on public interfaces. \n\nIt is lightweight, fast and easy to use. \n\nUsage of introspection is optional, depending on the amount of control you want to have and on performance requirements.\n\nCode sample\n-----------\n\nCode below will set-up a minimal actionscript application using Apollo. Notice the (nearly) complete lack of boiler-plate code. \n\nWe have to create an interface that will serve as a mapping proxy. In this example we will map the Person class to this interface.\n\n```actionscript\n\npublic interface IPersonInjectable\n{\n   function set person(val:Person):void;\n}\n``` \n\nSet up our person value object.\n\n```actionscript\n\npublic class Person{\n\n   public var first_name:String;\n   public var last_name:String;\n\n   function Person(fist_name:String, last_name:String)\n   {\n\tthis.first_name = first_name;\n\tthis.last_name = last_name;\n   }\n}\n\n```\n\nOur controller has to implement the above interface for the injection to work. Controllers will auto-register, so no code to be written.\n\n```actionscript\npublic class PersonViewController extends Controller implements IPersonInjectable\n{\n   public function PersonViewController() \n   {\n      super();\n   }\n \n   public function set person(val:Person):void\n   {\n      view.person = val;\n      trace(val.first_name + ' ' + val.last_name)\n   }\n}\n```\n\nIn our main class we have to do two things for this example to work.\n- Register interfaces\n- Instatiate a controller\n\nNow we can inject a message of type Person. Magic.\n\n```actionscript\n\n// Register our interfaces used to construct our mappings\nInjector.interfaces = [IPersonInjectable];\n\n// Create our controller\nnew PersonViewController();\n \n//Inject a message\nInjector.inject(new Person('Laurent', 'Zuijdwijk'))\n```\nPerformance considerations\n--------------------------\n\nI didn't do any benchmarking yet, but I expect performance to be pretty good. The introspection part is pretty lightweight, mainly because it is only done on a limited set of interfaces. But if you want to contruct mappings manually, this is possible as well. See the example below. \n\n```actionscript\nvar injectorMap:Vector.\u003cInjectorMapping\u003e = new Vector.\u003cInjectorMapping\u003e();\ninjectorMap.push(new InjectorPropertyMapping(IPersonInjectable, 'person', Person));\nInjector.model = injectorMap;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLaurentZuijdwijk%2FApollo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLaurentZuijdwijk%2FApollo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLaurentZuijdwijk%2FApollo/lists"}