extjs“iframe 架构"的缺点(我应该重构为 MVC 模式吗?) [英] Downside to extjs "iframe architecture" (should I refactor to MVC pattern?)

查看:18
本文介绍了extjs“iframe 架构"的缺点(我应该重构为 MVC 模式吗?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用iframe 架构"的 ExtJS 构建的现有 Intranet web 应用程序(完全内部),即它在索引页面上有一个顶部菜单和一个选项卡面板,以及大约 30 个其他单独的网页,它们在内部作为 iframes选项卡"打开主选项卡.

I have an existing intranet webapp (solely internal) built with ExtJS using an "iframe architecture", i.e. it has a top menu and a tabpanel on an index page and about 30 other separate webpages that open as iframes "tabs" inside the main tabpanel.

使用 iframe 没有任何特别的理由,所有内容都在同一个域中,并且大多数其他单独的页面几乎都是使用 ExtJS 库在 javascript 中编写的.几乎所有的 html 都由空的 HTML、HEAD 和 BODY 标签组成.

There is not any particular reason to use iframes, everything is on the same domain and most of these other seperate pages are written using the ExtJS library almost solely in javascript. The html on almost all of them consists of empty HTML, HEAD and BODY tags.

我真的很想使用 ExtJS MVC 架构重构它并抛弃 iframe,但因为一切正常",我无法证明花时间这样做是合理的.

I would really like to refactor this using the ExtJS MVC architecture and ditch the iframes but because "everything works" I can't justify taking the time to do this.

我有过但无法测试的一个想法是:这些单独的页面中的每一个都有自己的 Ext.onReady 事件和视口等,这个 web 应用程序必须加载完整的ExtJS 框架适用于它打开的每个 iframe-tab,严重放大了客户端资源的使用.任何人都可以确认这种类型的架构可以使用 ExtJS 框架做到这一点吗?

One thought I had but haven't been able to test is: with every one of these separate pages having it's own Ext.onReady event and viewport, etc, this webapp must be loading the full ExtJS framework for every iframe-tab it opens, seriously magnifying client resource usage. Can anyone confirm that this type of architecture would do that with the ExtJS framework?

还有其他非常充分的理由应该重构吗?

Is there any other very solid reasons this should be refactored?

或者,重构为 MVC 架构只会让我更轻松地维护代码而不会提升性能吗?(因为目前一切都按预期工作)

Or, would refactoring to MVC architecture only give me easier code maintenance and no performance boosts? (being that currently everything works as intended)

推荐答案

不幸的是,我没有与您手头的项目类似的项目,所以我无法自己测试,但这是我的 2c... :)

Unfortunately I don't have project similar to what you have handy so I can't test it myself but here are my 2c... :)

  1. 我确实认为每个页面都会启动自己的 ExtJs 框架副本,但我认为它只会对 CPU 和内存使用产生影响.网络流量应该不会有太大不同,因为核心 ExtJs 文件将被缓存.

  1. I do think each page will initiate its own copy of ExtJs framework but I think it only has an affect on CPU and memory usage. Network traffic should not be very different as core ExtJs files will be cached.

我确实建议您在运行此应用程序时检查网络流量,因为您将看到浏览器是如何处理所有这些的.您可能希望在核心 ExtJs 函数中添加一些额外的逻辑,以确认框架实际上是否已多次实例化.

I do recommend to check out network traffic while running this app as you will see how exactly browser handles all this. You might want to add some additional logic into core ExtJs functions to confirm if framework is in fact instantiated several times.

如果最终用户遇到一些性能问题 - 最好证明重构是合理的.不然有点难.当然,除非您有一些计划在不久的将来扩展功能并计划继续开发此应用程序.

If end users experience some performance issues - it might be very good point to justify re-factoring. Otherwise it's kind of hard. Unless of course you have some plans of expanding functionality in near future and planning on continue working on this application.

这篇关于extjs“iframe 架构"的缺点(我应该重构为 MVC 模式吗?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆