{"id":15835097,"url":"https://github.com/kaelzhang/egg-singletons","last_synced_at":"2025-04-01T12:29:09.469Z","repository":{"id":57220741,"uuid":"115382756","full_name":"kaelzhang/egg-singletons","owner":"kaelzhang","description":"Egg plugin to define multiple singletons in a convenient way.","archived":false,"fork":false,"pushed_at":"2017-12-29T15:14:47.000Z","size":10,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T13:16:15.928Z","etag":null,"topics":["egg","egg-plugin","eggjs","singletons"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/kaelzhang.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2017-12-26T03:40:26.000Z","updated_at":"2017-12-29T16:04:34.000Z","dependencies_parsed_at":"2022-08-28T23:23:24.297Z","dependency_job_id":null,"html_url":"https://github.com/kaelzhang/egg-singletons","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/kaelzhang%2Fegg-singletons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2Fegg-singletons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2Fegg-singletons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2Fegg-singletons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaelzhang","download_url":"https://codeload.github.com/kaelzhang/egg-singletons/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246638989,"owners_count":20809911,"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":["egg","egg-plugin","eggjs","singletons"],"created_at":"2024-10-05T14:20:32.864Z","updated_at":"2025-04-01T12:29:09.448Z","avatar_url":"https://github.com/kaelzhang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/kaelzhang/egg-singletons.svg?branch=master)](https://travis-ci.org/kaelzhang/egg-singletons)\n[![Coverage](https://codecov.io/gh/kaelzhang/egg-singletons/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/egg-singletons)\n\u003c!-- optional appveyor tst\n[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/kaelzhang/egg-singletons?branch=master\u0026svg=true)](https://ci.appveyor.com/project/kaelzhang/egg-singletons)\n--\u003e\n\u003c!-- optional npm version\n[![NPM version](https://badge.fury.io/js/err-object.svg)](http://badge.fury.io/js/err-object)\n--\u003e\n\u003c!-- optional npm downloads\n[![npm module downloads per month](http://img.shields.io/npm/dm/err-object.svg)](https://www.npmjs.org/package/err-object)\n--\u003e\n\u003c!-- optional dependency status\n[![Dependency Status](https://david-dm.org/kaelzhang/egg-singletons.svg)](https://david-dm.org/kaelzhang/egg-singletons)\n--\u003e\n\n# egg-singletons\n\nEgg plugin to define multiple singletons in a convenient way.\n\n## Install\n\n```sh\n$ npm install egg-singletons\n```\n\n## Configurations\n\nconfig/plugin.js\n\n```js\nexports.singletons = {\n  enable: true,\n  package: 'egg-singletons'\n}\n```\n\nconfig/config.default.js\n\n```js\nexports.singletons = {\n  foo: {\n    // Load into app, default is open\n    app: true,\n    // Load into agent, default is close\n    agent: false,\n    create: (config, app) =\u003e {\n      return a =\u003e {\n        console.log(a)\n      }\n    }\n  }\n}\n```\n\nThen:\n\n```js\n...\n  async doSomething () {\n    this.app.foo('hello')\n  }\n...\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaelzhang%2Fegg-singletons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaelzhang%2Fegg-singletons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaelzhang%2Fegg-singletons/lists"}