background preloader

Control Firefox

Facebook Twitter

Services namespace - MDC. Window.setTimeout - MDC. Syntax js setTimeout(code) setTimeout(code, delay) setTimeout(func) setTimeout(func, delay) setTimeout(func, delay, param1) setTimeout(func, delay, param1, param2) setTimeout(func, delay, param1, param2, /* …, */ paramN) Parameters func A function to be executed after the timer expires. code A TrustedScript or a string of arbitrary code that is compiled and executed every delay milliseconds. Delay Optional A non-negative integer indicating how long the timer should wait before the specified function or code is executed, in milliseconds.

Note: The delay has a maximum value of 2147483647 ms — specifying larger values may result in overflow or a 0 value being used. Param1, …, paramN Optional Additional arguments which are passed through to the function specified by func. Return value A positive integer (typically within the range of 1 to 2,147,483,647) that uniquely identifies the timer created by the call. Exceptions SyntaxError The code can't be parsed as a script. TypeError Description Nested timeouts. Javascript Tutorial - Using setInterval and setTimeout | Switch. In javascript, the two functions setInterval and setTimeout can be extremely useful and important, but using either of them in complex ways can be a confusing ordeal.

In this tutorial, I'm going to try and show the range of possibilities, from the very simple, to the complex, to the 'why oh why is it working like this!? '. So lets start out with the extremely simple - what do the setInterval and setTimeout functions do? They are both functions attached to the window object of a web page, and they allow, in a very crude manner, a sort of 'thread-like' control. The setTimeout call lets you tell the browser to execute a javascript call after a certain time has passed. It takes two arguments - what to execute, and how long to wait (in milliseconds). SetTimeout("alert('hi! ') This call will execute the code alert('hi! ') setInterval("alert('hi!

') This call will execute the code alert('hi'); every 500 milliseconds from now until the the page it is loaded on is closed. function foo(){ alert("hi! ") Passing objects between a Javascript-based XPCOM component and i. XPCOM IDL allows you to pass parameters of certain types only (e.g., string, integer), in addition to objects with XPCOM interfaces (e.g., nsISupports).

In order to pass anything else (e.g., a Javascript array, a Java object) from the client of a Javascript-based XPCOM component into the component, you need to wrap the object to be passed in another XPCOM object implemented using Javascript: function WrapperClass(object) { this.wrappedJSObject = this; this.object = object; } Now you can call the first XPCOM component passing in any kind of object by wrapping it first: theComponent.foo(new WrapperClass(theObject)) And inside foo(), the wrapped object can be retrieved as follows: foo : function(arg) { var theActualObject = arg.wrappedJSObject.object; } In the interface definition of theComponent (in your IDL file), you need to declare that foo() takes an nsISupports parameter.

Passing arguments to XUL file. Np wrote:Can it be done? Yes. I think you'll have to elaborate on your question. Does that XUL page not open? Are you having problems reading the arguments? Etc. Above is part of the cacheviewer.xul codes. Do you know how to do this ? Rgds, Edmond Gunarso.

Java

Python. C++ Generic. XPCOM. Virtual thumbshoter.