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

精读《依赖注入简介》 #440

Closed
ascoders opened this issue Sep 3, 2022 · 6 comments
Closed

精读《依赖注入简介》 #440

ascoders opened this issue Sep 3, 2022 · 6 comments

Comments

@ascoders
Copy link
Owner

ascoders commented Sep 3, 2022

精读文章:Dependency Injection in JS/TS – Part 1
了解一下依赖注入思维和实现。


精读《依赖注入简介》

@ascoders ascoders closed this as completed Sep 5, 2022
@HiWayne
Copy link

HiWayne commented Sep 5, 2022

能介绍一下为什么spring解决循环依赖设计成3层缓存吗?node里的request.js解决模块的循环依赖只用了1层缓存。

@ascoders
Copy link
Owner Author

ascoders commented Sep 5, 2022

我还没有水平可以几句话讲清楚,应该和 AOP 的代理对象创建流程有关,有经验的同学可以评论一下。

@NameWjp
Copy link

NameWjp commented Sep 5, 2022

保证依赖顺序正确那里讲的很棒,感谢分享🙏

@zeyongTsai
Copy link

export type RandomGenerator = () => number;

export const randomNumberImplementation =
  ({ randomGenerator }: Deps) =>
  (max: number): number => {
    return Math.floor(randomGenerator() * (max + 1));
  };

export const randomNumber = (max: number) =>
  randomNumberImplementation(Math.random, max);

这段代码不对吧,上面不是一个 HOC 吗?

@a243065157
Copy link

a243065157 commented Sep 29, 2022 via email

@xjq7
Copy link

xjq7 commented Mar 9, 2023

@HiWayne 你是指 commonjs 的循环依赖吗

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

No branches or pull requests

6 participants