{"id":23058671,"url":"https://github.com/suhdev/shinjector","last_synced_at":"2025-04-03T06:18:42.345Z","repository":{"id":33292946,"uuid":"36937674","full_name":"suhdev/shInjector","owner":"suhdev","description":"A simple dependency injection module for browser JavaScript applications.","archived":false,"fork":false,"pushed_at":"2015-10-26T20:09:00.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-06T21:47:37.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/suhdev.png","metadata":{"files":{"readme":"README.md","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":"2015-06-05T14:38:09.000Z","updated_at":"2015-06-05T14:38:42.000Z","dependencies_parsed_at":"2022-08-17T19:00:48.651Z","dependency_job_id":null,"html_url":"https://github.com/suhdev/shInjector","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2FshInjector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2FshInjector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2FshInjector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2FshInjector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suhdev","download_url":"https://codeload.github.com/suhdev/shInjector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246944383,"owners_count":20858772,"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-12-16T02:16:56.532Z","updated_at":"2025-04-03T06:18:42.330Z","avatar_url":"https://github.com/suhdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shInjector\n\nA simple dependency injection class for JavaScript apps. Supports both named parameters and Angular strict injection model (using arrays). The module has no dependencies, and can be intergrated with any JavaScript application. There will also be a NodeJS version of the injector to be released soon.  \n\n## Usage\n\nJust include the file `shinject.min.js` in your html files. \n```html\n\n\u003cscript type=\"text/javascript\" src=\"PATH_TO_/shinjector.min.js\"\u003e\u003c/script\u003e\n\n```\n\nThen use it in your code: \n\n```javascript\n\nvar injector = new shInjector();  \ninjector.register('testServ',function testServ(logger,serv1){\n\treturn {\n\t\ttestServ:function(){\n\t\t\treturn 'testserv'; \n\t\t}\n\t};\n});\n\ninjector.register('serv1',function testServ2(logger,testServ){\n\treturn {\n\t\ttestServ2:function(){\n\t\t\treturn 'testserv2'; \n\t\t}\n\t};\n});\n\ninjector.register('servz',['logger','serv1','testServ',function testServx(logger,serv1,serv2){\n\treturn {\n\t\ttestServZ:function(){\n\t\t\treturn serv1.testServ2()+\" \"+serv2.testServ(); \n\t\t}\n\t};\n}]);\n\n//then to get an instance just use \n//injector.get('__NAME__OF__ENTITY__')\nvar servz = injector.get('servz');\nservz.testServZ(); \n\n```\n\n\nSuhail Abood \u0026copy; 2015 ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Fshinjector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuhdev%2Fshinjector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Fshinjector/lists"}