cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Maj <...@adobe.com>
Subject Re: Plugin <merges> tag
Date Tue, 09 Jul 2013 20:15:47 GMT
2 is more explicit. Either case require a good docs update.

On 7/9/13 12:57 PM, "Andrew Grieve" <agrieve@chromium.org> wrote:

>Another use-case that's come up with the core plugins is the ability to
>clobber one module with a platform-specific one (instead of merging with
>it).
>
>Right now where this was happening we're copy & pasting the <js-module>
>tag
>for each non-specialized platform. Not great.
>
>Option 1:
>Allow <js-module> within platform to have the same name= without plugman
>complaining
>
>Option 2:
><js-module name="SameName" override="true">
>
>I think I prefer option 1.
>
>
>
>
>
>
>
>
>On Mon, Jul 8, 2013 at 2:51 PM, Andrew Grieve <agrieve@chromium.org>
>wrote:
>
>> You specify what JS path you want to merge into. I think this is wrong.
>>
>> E.g.:
>> <js-module src="..." name="A" >
>>   <clobbers target="window.plugins.A" />
>>   <clobbers target="window.oldPath.A" />
>> </js-module>
>>
>> <platform name="ios">
>> <js-module ...>
>>   <merges target="window.plugins.A" />
>>   <merges target="window.oldPath.A" />
>> </js-module>
>> </platform>
>>
>> With this example, you'd actually only need to have a single merge line,
>> since window.plugins.A and window.oldPath.A actually refer to the same
>> object. It's also less apparent when specifying the symbol path, that
>> you're modifying the actual module that maps to it.
>>
>> Instead - I think what better captures the merges use-case would be to
>> specify the name of the *module* to merge into. E.g.:
>>
>> <js-module src="..." name="A">
>>   <clobbers target="window.plugins.A" />
>>   <clobbers target="window.oldPath.A" />
>> </js-module>
>>
>> <platform name="ios">
>> <js-module ...>
>>   <merges target="A" />
>> </js-module>
>> </platform>
>>
>>
>> We could then also have a plugman-time check that the "A" module exists
>>to
>> be merged into.
>>
>> Existing uses of <merges> are minimal, so I think we can change this now
>> without harm:
>>
>> $ grep merges cordova*plugin*/plugin.xml
>> cordova-plugin-contacts/plugin.xml:            <merges
>> target="navigator.contacts" />
>> cordova-plugin-contacts/plugin.xml:            <merges target="Contact"
>>/>
>> cordova-plugin-dialogs/plugin.xml:        <merges
>> target="navigator.notification" />
>> cordova-plugin-dialogs/plugin.xml:            <merges
>> target="navigator.notification" />
>> cordova-plugin-file/plugin.xml:            <merges
>>target="window.Entry" />
>> cordova-plugin-file/plugin.xml:            <merges
>> target="window.FileUploadOptions" />
>> cordova-plugin-file/plugin.xml:            <merges
>> target="window.FileUploadOptions" />
>>


Mime
View raw message