IBM Worklight 6.0 - 如何使用预制的Dojo图层来包含Dojo补丁? [英] IBM Worklight 6.0 - How to include Dojo patch with pre-built Dojo layers?

查看:157
本文介绍了IBM Worklight 6.0 - 如何使用预制的Dojo图层来包含Dojo补丁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Dojo 1.9开发Worklight 6.0应用程序,我们在Galaxy SII,SIII,运行Android v4.1.2(非常常见)的笔记本设备上遇到一些页面导航问题。



我们看到这些问题已通过 Dojo补丁#17164 解决。

此修补程序不包括在Worklight的默认Dojo版本中。



我们尝试通过将文件放在项目的dojox\mobile文件夹中但不起作用 - 我们猜测它在构建期间被未修补的类覆盖。



有没有其他方法来包含/定义这个补丁?
我们喜欢避免自定义建立Dojo来跟上WL版本。

解决方案

我已经使用了猴子补丁完成你想要做的事情。

  require(['dojox / mobile / css3'],function(css3){
css3.prototype.name = function(p,hyphen){
//将你的修补版本的功能放在这里
};
});

您需要确保此代码在需要使用修补版本的任何代码获取之前执行调用。



您也将从原始功能复制代码。每次升级Dojo或Worklight时,都需要评估补丁是否仍然需要,或者补丁需要修改,因为对原始功能的修改可能不是修补程序的一部分。



http://en.wikipedia.org/wiki/Monkey_patch



是猴子补丁真的那么糟糕?


Developing Worklight 6.0 applications with Dojo 1.9, we're encountering some page navigation problems on Galaxy SII, SIII, Note devices with running Android v4.1.2 (very common).

We see these issues were resolved by Dojo patch #17164.
This patch is not included in Worklight's default Dojo build.

We tried to include it by placing the files in the project's dojox\mobile folder but with no effect - we guess it is being overwritten by unpatched classes during build.

Is there any other way to include/define this patch? We prefer to avoid custom building Dojo ourselves to keep up with WL versions.

解决方案

I have used monkey patching to accomplish what you are trying to do.

require(['dojox/mobile/css3'], function(css3) {    
    css3.prototype.name = function(p, hyphen) {
        // put your patched version of the function here.
    };
});

You will need to make sure this code gets executed before any code that needs to use the patched version gets called.

You will also be copying code from the original function. Every time you upgrade Dojo or Worklight, you will need to evaluate whether the patch is still required or if the patch needs to be modified because of changes made to the original function that may not be part of the patch.

http://en.wikipedia.org/wiki/Monkey_patch

Is "monkey patching" really that bad?

这篇关于IBM Worklight 6.0 - 如何使用预制的Dojo图层来包含Dojo补丁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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