Take the tour ×

Sorry for possibly stupid question but I ask you to be lenient, cause I simply do not like to leave some gaps when I read docs.

Consider the following snippet from developer.mozilla.org:

void initCustomEvent(
    in DOMString type,
    in boolean canBubble,
    in boolean cancelable,
    in any detail

As far ad I know, there is no such syntax in JavaScript like void. But this is simply a convention to tell, that the method does not return anything. (Please correct me if I'm wrong).

But what does it mean in ?

share|improve this question
Interface Definition Language en.wikipedia.org/wiki/Interface_description_language –  c.P.u1 Jun 18 at 17:54
@c.P.u1 you have the correct answer here –  Nirk Jun 18 at 20:41
add comment

1 Answer

up vote 3 down vote accepted

It mean the parameter is an "in-parameter", i.e. the value goes into the function, in contrast to "out-parameters" where the function adds data to that argument or that location in memory, which can then be used further by the calling code.

Here is an example from the MDN documentation containing an "out-parameter":

void get(
  in string prop,
  in nsIIDRef iid,
  [iid_is(iid),retval] out nsQIResult result

And a JavaScript example:

function range(n, result) {

// to be called as
var foo = [];
range(10, foo);
console.log(foo); // shows [0,1,2,3,4,5,6,7,8,9]

"out-parameters" are not popular in JavaScript, but seem to be more common in C or C++, which is the language Firefox is developed in.

As hinted by c.P.u1, this is not JavaScript syntax, this is simply a description of the interface. Mozilla developed and used XPIDL. From their documentation:


You are right, void means that the function does not return anything, but the void operator does exist (though it has nothing to do with the interface description).

share|improve this answer
add comment

Your Answer


