6.mxGraph 与 JavaScript 框架的集成

6.mxGraph 与 JavaScript 框架的集成

精选文章moguli202025-06-30 0:14:583A+A-

2.2 JavaScript and Web Applications JavaScript 与 Web 应用

[翻译]
Web 应用程序,特别是使用 JavaScript 在 Web 浏览器中模拟桌面应用程序行为的尝试,仍是软件工程中相对较新的领域。JavaScript 的三个主要问题被认为是生产高质量应用的障碍:性能、缺乏桌面应用中的原生功能以及浏览器之间的 API 不一致。

[原文]
Web applications, specifically the use of JavaScript to attempt to emulate desktop application-like behaviour in web browsers, is still a relatively new field of software engineering. There are three main issues with JavaScript that are perceived to be a barrier to producing high quality applications, performance, lack of native functionality available in desktop applications and inconsistent APIs between browsers.

  • emulate /'emjulet/ 模拟
  • desktop /'desktɑp/ 桌面
  • perceived /pr'sivd/ 感知的
  • barrier /'baerir/ 障碍
  • inconsistent /nkn'sstnt/ 不一致的

[翻译]
为解决功能和 API 问题,已经投入了大量努力开发框架库。这些库的许多需求源于改善网站设计和可用性,以及协助生产我们通常称为应用程序功能(菜单、窗口、对话框、持久性、事件处理等)的功能。它们还提供桌面应用开发者认为理所当然的 JavaScript 中缺失的一些基本功能,如基本数学和集合功能。

[原文]
There has been considerable effort toward developing framework libraries to solve two of the problems, the functionality and API issues. The requirements of many of these libraries is driven by both improving web site design and usability, as well as to assist production of what we generally refer to as application features (menus, windows, dialogs, persistence, event handling, etc). They also provide certain base functionalities missing in JavaScript that desktop application developers take for granted, such as basic maths and collections functionality.

  • considerable /kn'sdrbl/ 相当大的
  • framework /'fremwrk/ 框架
  • usability /juz'blti/ 可用性
  • persistence /pr'sstns/ 持久性
  • collections /k'leknz/ 集合

[翻译]
如今,许多 JavaScript 框架都支持 IDE 开发,所有主流浏览器现在都包含 JavaScript 调试器,无论是原生的还是作为插件。JavaScript 没有编译阶段(它是一种解释型语言),因此除非您在 IDE 中获得语法检查工具,否则基本的拼写错误通常只能在运行时捕获。因此,虽然没有一个完整的 JavaScript 开发包,但有许多供应商提供生产 JavaScript 应用程序所需的各个组件。

[原文]
Many of these JavaScript frameworks have IDE support for development nowadays and all of the major browsers now contain JavaScript debuggers, either natively or as a plug-in. There is no compilation phase with JavaScript (it is an interpreted language) so basic typographical errors are often only caught at runtime, unless you obtain a syntax checking tool in your IDE. So although there is not one complete package for your JavaScript development needs, there are a number of vendors providing the individual components you need to produce JavaScript applications effectively.

  • IDE /a di 'i/ 集成开发环境
  • debuggers /d'bɡrz/ 调试器
  • compilation /kmp'len/ 编译
  • typographical /tap'ɡraefkl/ 拼写
  • syntax /'sntaeks/ 语法

2.2.1 Third-Party JavaScript Frameworks 第三方 JavaScript 框架

2.2.1.1 Native JavaScript Frameworks and Libraries 原生 JavaScript 框架和库

[翻译]
与其列出并比较每个 JavaScript 框架,请查看维基百科关于 Web 应用框架和 JavaScript 比较的条目。比较不应视为权威,但它展示了提供的功能类型,如事件处理、动画、小部件、AJAX 请求支持等。

[原文]
Rather than list and compare every JavaScript framework, please see the wikipedia entries for web application frameworks and the comparison of JavaScript. The comparison should not be considered authoritative, more so it illustrates the types of features provided, such as event handling, animation, widgets, AJAX request support etc.

http://en.wikipedia.org/wiki/List_of_JavaScript_libraries#JavaScript
http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks
  • authoritative /'θrtetv/ 权威的
  • illustrates /'lstrets/ 展示
  • animation /aen'men/ 动画
  • widgets /'wdts/ 小部件
  • AJAX /'edaeks/ 异步 JavaScript 和 XML

[翻译]
请注意,许多框架添加了隐式行为,使 JavaScript 看起来更像面向对象的语言,并增强语言的基础功能。在编写 mxGraph 的布局部分时,发现这种隐式行为以难以调试的方式破坏了一个示例。请注意,这可能会导致问题,如果您选择了一个框架,请确保了解它引入了哪些隐式行为。

[原文]
Be aware that many frameworks add implicit behaviours to make JavaScript appear more like an OO language and to increase the base functionality of the language. During the writing of the layout portion of mxGraph, it was found that this implicit behaviour broke an example in a very hard to debug manner. Be aware that this may cause problems and if you select a framework ensure you understand which implicit behaviours it introduces.

  • implicit /m'plst/ 隐式的
  • behaviours /b'hevjrz/ 行为
  • OO /o 'o/ 面向对象
  • debug /di'bɡ/ 调试
  • ensure /n'r/ 确保

[翻译]
在选择框架和/或库时,考虑哪些框架将您绑定到特定的功能行为,并寻找提供动画等功能的库,这些功能是独立的可选模块,您可以在不被整体设计绑定的情况下使用。

[原文]
When selecting a framework and/or libraries think about which frameworks tie you into certain functional behaviour and look for libraries that provide features such as animation as distinct, independent blocks, that you can use without being tied into the overall design.

  • selecting /s'lekt/ 选择
  • tie /ta/ 绑定
  • functional /'fknl/ 功能的
  • distinct /d'stkt/ 独立的
  • independent /nd'pendnt/ 独立的

2.2.1.2 Integration of mxGraph and JavaScript frameworks/mxGraph 与 JavaScript 框架的集成

[翻译]
这一领域常常被误解,简单来说,无需进行集成。Web 应用程序通常由一个或多个 div 元素组成,应用程序的 JavaScript 包装在 HTML 中放置在这些 div 中。如果您为 mxGraph 创建一个 div 作为容器,该区域是一个独立的 mxGraph 应用程序显示区域。它可以与任何后端服务器通信,但该 div 与页面其他部分没有相互依赖关系,除了各自占用的区域。这包括事件处理,mxGraph 可以处理其容器的事件,即使页面的其余部分使用了完全不同的事件模型。只要 mxGraph 或页面上的其他库和框架不引入破坏页面某部分的隐式行为,客户端集成就不是需要分析的问题。

[原文]
This area is often misunderstood, put simply, there is no integration required. Web applications generally comprise one or more div elements into which the HTML wrapping the JavaScript of the application is placed. If you create a div as a container for an mxGraph, that area is a stand-alone display for the mxGraph application. It can communicate itself with any back-end server, but there is no interdependence between that div and the rest of the page, other than the area each take up. This includes event handling, mxGraph can handle the events for its container, even if the rest of the web page used a completely different event model. As long as neither mxGraph nor the other libraries and frameworks on the page introduce implicit behaviours that break one part of the page, the issue of client integration is not something that needs analysis.

  • misunderstood /msndr'std/ 误解
  • comprise /km'praz/ 包含
  • div /dv/ 文档分区
  • stand-alone /'staend lon/ 独立的
  • interdependence /ntrd'pendns/ 相互依赖

[翻译]
mxGraph 后端功能的集成,即位于服务器端的功能,是后续章节的主题。

[原文]
Integration of the mxGraph back-end functionality, that which sits at the server-side is the subject of a later chapter.

  • back-end /'baek end/ 后端
  • server-side /'srvr sad/ 服务器端
点击这里复制本文地址 以上内容由莫古技术网整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!
qrcode

莫古技术网 © All Rights Reserved.  滇ICP备2024046894号-2