Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove getContainer #142

Merged
merged 2 commits into from
Jul 18, 2022

Conversation

noahziheng
Copy link
Member

resolve #141

@noahziheng noahziheng requested review from JerrysShan and hyj1991 July 14, 2022 10:55
@@ -11,8 +11,8 @@ import { ArtusLogger, Logger } from './logger';

export class ArtusApplication implements Application {
public manifest?: Manifest;
public container: Container;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 container 其实可以和 execution container 一样设置进容器:

this.container.set({id: Container, value: this.container});

不需要作为 public 属性对外使用,这样外部想用可以直接 Inject

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 进容器的改动已经做在 feat: load default class early #139 里面了
  2. 对于上层框架来说,还是有可能会用到 app.contianer,就像现在广泛使用了的 app.getContainer() 和 ctx.container,即然管不住还不如放开,推荐 Inject 就是了

@noahziheng noahziheng force-pushed the refactor/remove-get-container branch from e26ea64 to 57d256e Compare July 18, 2022 10:36
@hyj1991 hyj1991 merged commit f132863 into artusjs:master Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] 移除 app.getContainer,规范 Container 获取途径
2 participants