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

Facade questions #115

Open
jon9090 opened this issue Nov 11, 2022 · 0 comments
Open

Facade questions #115

jon9090 opened this issue Nov 11, 2022 · 0 comments

Comments

@jon9090
Copy link

jon9090 commented Nov 11, 2022

Hi, @manfredsteyer hope you can explain some things about this library.

  • facade should be in the feature-component providers? because I can see each feature created with the facade, should the facade be co-responsive to the component life cycle and destroyed when the component is destroyed?
  • only facades are allowed to export from domain lib?
  • facades should expose other services, and the component can't have access to those services?
  • this code it's how it's should be?
@Component({})
export class Component {
  facade = inject(facade);
  vm = facade.vm;

  ngOnInit() { this.facade.loadData() };
}

@Injectable({ provideIn: 'root')
export class Facade {
   vm = new BehaviorSubject(..);
   loadData = this.fooService.loadData;

}

@Injectable({ provideIn: 'root')
export class FooService {
   vm = new BehaviorSubject(..);
   api = inject(ApiService);
 
   loadData() {
    return this.api.getData(); 
   }
}

domain/index.ts
export * from './facade1';
export * from './facade2';
export * from './facade3';
  • all the logic in the facade? Does it mean that no functions allow in the component?
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

1 participant