incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Maj <...@adobe.com>
Subject Re: git commit: Allow prototype overrides of constructor objects for merges.
Date Fri, 16 Mar 2012 18:55:53 GMT
Ill convert the ios/android prototype overrides to this form and see if
its still working on those platforms.

On 3/16/12 11:51 AM, "Drew Walters" <deedubbu@gmail.com> wrote:

>That's the best way I could think of doing it.  Worked on BB browsers
>OS 5 - 7.  It looks a bit hacky to me but it works.
>
>On Fri, Mar 16, 2012 at 1:41 PM, Filip Maj <fil@adobe.com> wrote:
>> Hah, was just gonna ask you for this kind of feature Drew! Psychic ;)
>>
>> On 3/16/12 11:37 AM, "deedubbu@apache.org" <deedubbu@apache.org> wrote:
>>
>>>Updated Branches:
>>>  refs/heads/master 16f5c42bc -> 7e623fa95
>>>
>>>
>>>Allow prototype overrides of constructor objects for merges.
>>>
>>>
>>>Project: 
>>>http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
>>>Commit:
>>>http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/7e623
>>>fa
>>>9
>>>Tree:
>>>http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/7e623fa
>>>9
>>>Diff:
>>>http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/7e623fa
>>>9
>>>
>>>Branch: refs/heads/master
>>>Commit: 7e623fa9564866aa60cdf8ae375a3d11abf97490
>>>Parents: 16f5c42
>>>Author: Drew Walters <deedubbu@gmail.com>
>>>Authored: Fri Mar 16 13:35:41 2012 -0500
>>>Committer: Drew Walters <deedubbu@gmail.com>
>>>Committed: Fri Mar 16 13:35:41 2012 -0500
>>>
>>>----------------------------------------------------------------------
>>> lib/builder.js |   10 ++++++++--
>>> 1 files changed, 8 insertions(+), 2 deletions(-)
>>>----------------------------------------------------------------------
>>>
>>>
>>>http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/7e623fa
>>>9/
>>>lib/builder.js
>>>----------------------------------------------------------------------
>>>diff --git a/lib/builder.js b/lib/builder.js
>>>index 2578180..0ff2f73 100644
>>>--- a/lib/builder.js
>>>+++ b/lib/builder.js
>>>@@ -57,10 +57,16 @@ function include(parent, objects, clobber, merge) {
>>> function recursiveMerge(target, src) {
>>>     for (var prop in src) {
>>>         if (src.hasOwnProperty(prop)) {
>>>-            target[prop] = typeof src[prop] === 'object' ?
>>>-                    recursiveMerge(target[prop], src[prop]) :
>>>src[prop];
>>>+            if (typeof target.prototype !== 'undefined' &&
>>>target.prototype.constructor === target) {
>>>+                // If the target object is a constructor override off
>>>prototype.
>>>+                target.prototype[prop] = src[prop];
>>>+            } else {
>>>+                target[prop] = typeof src[prop] === 'object' ?
>>>recursiveMerge(
>>>+                        target[prop], src[prop]) : src[prop];
>>>+            }
>>>         }
>>>     }
>>>+    return target;
>>> }
>>>
>>> module.exports = {
>>>
>>


Mime
View raw message