Skip to content

Access to context outside of marble.js streams #340

Answered by JozefFlakus
jan-kacina asked this question in Q&A
Discussion options

You must be logged in to vote

I think you should rebuild the concept of PropagateLoginStatus and think about it as a complete dependency with all relevant and connected actions inside. You should definitely have a deep dive into the concept of Dependency Injection - it is a powerful mechanism but sometimes hard to understand. I hope the following snippets will help you better understanding the way how it should be implemented :)

loginStatusPropagator.ts:

export type LoginStatusPropagator = ReturnType<typeof LoginStatusPropagator>;

export const LoginStatusPropagatorToken = createContextToken<LoginStatusPropagator>('LoginStatusPropagator');

export const LoginStatusPropagator = createReader(ask => {
  let subscription;

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@JozefFlakus
Comment options

Comment options

You must be logged in to vote
1 reply
@jan-kacina
Comment options

Comment options

You must be logged in to vote
2 replies
@jan-kacina
Comment options

@JozefFlakus
Comment options

Answer selected by jan-kacina
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants