[Greasemonkey] import / include / link to external extension

Nikolas Coukouma lists at atrus.org
Tue Jul 12 18:35:18 EDT 2005


Jeremy Dunck wrote:

>On 7/12/05, yonatan maman <yonatanm at gmail.com> wrote:
>  
>
>>Hi
>>         I have an extension installed on my FF that supplies an API
>>(function) that I want to use from my GM script.
>> 
>> how can I import / include / link to this API ?
>>    
>>
>
>As  a user script author, you can't.  We try to keep the browsing
>environment secure, so whether to expose a chrome func depends on what
>the func does.
>
>What extension and func?
>
>Have you considered writing your own extension, or starting with the
>user script to extension compiler?
>
I think this is the second request I've seen that would be aided by a
simple API for adding functions to Greasemonkey.
This should be really easy to add and might make the internals a bit
cleaner. I'm thinking of:
export_to_GM( Object obj, String as );
for example:
export_to_GM( GM_hitch( storage, "setValue"), "GM_setValue" );

Internally, we can store them in an object and use a "for( i in obj )"
to register them all in the window.

Again: it's rare, possibly never actually useful. On the other hand, it
has potential, requires little effort, and results in a nice generalization.

"Bug" filed:
http://bugzilla.mozdev.org/show_bug.cgi?id=10969

-Nikolas Coukouma


More information about the Greasemonkey mailing list