Yes, I noticed that in

http://hg.toolness.com/ubiquity-firefox/file/08144e79c252/ubiquity/chrome/content/cmdutils.js

(lines 151 to 164) too. But I cant make sense of the callback part.

More specifically, assuming I have a script say http://xyz/script.js and it
defines an object myObject with methods a() and b(). What do I need to do to
be able to:

a) Load the remote script .. I think this is where CmdUtils.injectJavascript
comes in
b) Get hold of a reference MyObject and
c) Use this to Invoke methods a() and b()

>From what I see I need to do is

CmdUtils.injectJavascript( "http://xyz/script.js";, mycallback );

Sorry, I am being bit thick here. But It's the callback bit I cant seem to
fathom. I need to be able to do something on the lines of (this is
pseudocode):

var myRemoteScript = CmdUtils.injectJavascript( "http://xyz/script.js"; );
var myRemoteObject = myRemoteScript.MyObject;
myRemoteObject.a( some_params );

I cant translate the safeWrapper() part into doing what I want.

Any pointers?

- Mayuresh


On Thu, Nov 27, 2008 at 4:00 PM, Abimanyu Raja <[EMAIL PROTECTED]>wrote:

> Jquery is loaded (although from a local file) using that function -
>
> CmdUtils.loadJQuery = function loadJQuery(func) {
>   CmdUtils.injectJavascript(
>     "resource://ubiquity-scripts/jquery.js",
>     Utils.safeWrapper( function() {
>       var contentJQuery = CmdUtils.getWindowInsecure().jQuery;
>       func(contentJQuery);
>     })
>   );
>
> };
>
>
> 2008/11/27 <[EMAIL PROTECTED]>
>
>> How about an example?
>>
>>
>> On Thu, Nov 27, 2008 at 3:46 PM, Abimanyu Raja <[EMAIL PROTECTED]>wrote:
>>
>>> Yes, you should use CmdUtils.injectJavascript to load a external script
>>> from the web.
>>>
>>> - Abi
>>>
>>> 2008/11/27 <[EMAIL PROTECTED]>
>>>
>>> Also, are there any performance considerations that need to be made when
>>>> doing so.
>>>>
>>>>
>>>> On Thu, Nov 27, 2008 at 3:39 PM, <[EMAIL PROTECTED]> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am not sure if this was covered before, but I have a external .JS lib
>>>>> that I want to be able to call within my ubiquity command. Can anyone give
>>>>> me any pointers? From some previous thread, I think
>>>>> CmdUtils.injectJavascript needs to be used. Is this correct?
>>>>>
>>>>> thanks,
>>>>>
>>>>> --
>>>>> Mayuresh
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Mayuresh
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>> --
>> Mayuresh
>>
>>
>>
>
> >
>


-- 
Mayuresh

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to