Sharing datasources between components on a Boilerplatejs app

限于喜欢 提交于 2019-12-12 17:18:36

问题


I'm using Boilerplatejs to structure a web application where I have "forums" and "categories". On the categories module, I have components that list all categories and edit a specific category (just like the list-detail example bundled with boilerplatejs).

When registering a new forum, I need to list all the categories, which are retrieved using Ajax on a tag on the module initialization, so, if I add a new category using the categories module, that list won't be updated when I add a new forum.

Following the BoilerplateJS guidelines, I could emit an event when the categories list is updated, so other modules could trigger a new ajax request and fetch the updated categories list, but would it be sane to have a shared datasource (or component) which would minimize the network requests ?

来源:https://stackoverflow.com/questions/13127153/sharing-datasources-between-components-on-a-boilerplatejs-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!