最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dependency injection - Multi-Window electron angular app with single context - Stack Overflow

programmeradmin4浏览0评论

Im currently running an Electron app with an Angular frontend. I plan to extend the application by adding a second window that displays an different view of the same Angular frontend. Since the frontend relies heavily on dependency injection to react to internal model changes, it’s essential that both windows share the same model state. This way, any changes made in the main window are immediately reflected in the second window, and vice versa.

For instance, in the main window, a component injects a rendering manager object. When a button is pressed, it toggles the state of the rendering process—switching between running and stopped. I want this rendering to appear in the second window. Therefore, a component in that window must inject the same rendering manager to receive notifications about state changes and update its display accordingly.

I tried creating two windows in electron, loading the same angular app. However this will load separate instances of the angular pages with their own dependency injection container.

Is it possible to achieve such a setup in Electron that uses the same dependency injection provider (or angular instance) across multiple windows?

发布评论

评论列表(0)

  1. 暂无评论