GWTP 中的多个入口点

Multiple entry points in GWTP

GWTP uses Formfactors 支持多个目标,例如;

除了多个目标,我想通过不同的域或地址支持我的项目的多个桌面版本。

这意味着多个 entry points 连接到不同的 URL 的

如何在 GWTP 中为不同的 URL(或地址)配置多个入口点?

https://gitter.im/gwtproject/gwt# 的愉快聊天中提出了一些非常好的想法;

基本思路是只检查 URL,然后启动不同的根面板(桌面或仪表板)。更进一步,可以使用项目中的多个模块(具有不同的 URL)实现这种不同的 desktop/dashboard 实现(如 tbroyer 原型),从而可以使用具有共享功能的模块。

另一种方法是在检查 URL 后决定提供哪种排列。 这只是当前 GWTP 形式因素实施的变体;

https://github.com/ArcBees/GWTP/blob/master/gwtp-core/gwtp-mvp-client/src/main/resources/com/gwtplatform/mvp/FormFactor.gwt.xml

Shows how GWTP defines their property to control different formfactors the class in the "property-provider" tag will generate the JS that actually selects a value (i.e. how does the .nocache.js know which device it is running on).

https://github.com/ArcBees/GWTP/blob/master/gwtp-core/gwtp-mvp-client/src/main/resources/com/gwtplatform/mvp/rebind/linker/formFactor.js

Is the guts of it, supporting both a "if it matches these browsers, we are mobile" sort of thing, plus also the ability to override it from the URL and specify which should be used, for debugging and such (or "request desktop site")

Colin Alworth

与其使用逻辑来确定哪种浏览器是 运行,不如检查 window.location.hostname 等以查看它是否包含桌面与仪表板