Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Sample interface document

A make-believe interface that eats and enjoys cookies. This is an example of what an interface document should look like; however,it's not a document about a real interface.
1.0
43
Introduced
Gecko 1.5
Deprecated
Gecko 14.0
Obsolete
Gecko 20.0
Inherits from: nsICookieFan Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Note: The article's name should be simply "nsICookieMonster" but is not in order to make it more obvious this is an example.  Also, you should add the "Interfaces" tag to your article, as well as "Interfaces:Scriptable" if the interface is scriptable.

Implemented by: @mozilla.org/cookie-monster;1. To create an instance, use:

var cookieMonster = Components.classes["@mozilla.org/cookie-monster;1"]
                    .createInstance(Components.interfaces.nsICookieMonster);

Method overview

void eatCookie(in nsICookie cookieToEat);
AString getFunnySaying(in integer number);
void sayYummy(in AString language); Native code only!
void sing();

Attributes

Attribute Type Description
favoriteCookie integer The cookie monster's favorite kind of cookie. Must be one of the constants defined under Constants on this page.
hungerLevel integer A value from 0-100 indicating how hungry the cookie monster is. 0 means "stuffed to the brim with cookies" and 100 means "I'm so empty of cookies! Feed me now!"
name AString The cookie monster's name. Read only.

Constants

Constant Value Description
COOKIE_FLAVOR_SUGAR 1 Simple sugar cookie.
COOKIE_FLAVOR_CHOCOLATE_CHIP 2 Chocolate chip cookie.
COOKIE_FLAVOR_PEANUT_BUTTER 3 Peanut butter cookie.
COOKIE_FLAVOR_DOUBLE_CHOCOLATE 4 Chocolate cookie with chocolate chips.
COOKIE_FLAVOR_OTHER 0 An unknown type of cookie.

Yumminess constants

Constant Value Description
COOKIE_NOT_YUMMY 1 The cookie is disgusting.
COOKIE_SORT_OF_YUMMY 2 The cookie is good but not awesome.
COOKIE_EXTREMELY_YUMMY 3 The cookie is really, really yummy.
COOKIE_OMG_YUMMY 4 OMG THIS IS THE BEST COOKIE EVAR!1!!1.

Methods

eatCookie()

Feeds a cookie to the cookie monster.

void eatCookie(
  in nsICookie cookieToEat
);
Parameters
cookieToEat
The cookie to eat.

getFunnySaying()

Returns a string containing a funny quote the cookie monster might say.

AString getFunnySaying(
  in integer number
);
Parameters
number
The saying number to return.
Return value

An AString containing the requested funny quote. If the specified quote number is invalid, an exception is thrown.

Exceptions thrown
NS_ERROR_FAILURE
Unable to locate the requested quote.

Native code only!

sayYummy

Says something appreciative of the tastiness of the cookie in the specified language.

void sayYummy(
  in AString language
);
Parameters
language
The localization identification indicating the language in which the cookie monster is to express his love of cookies.

sing()

Sings the song "C is For Cookie."

void sing();
Parameters

None.

Remarks

Remember, this isn't a real interface. This is where you would provide additional information about the interface as necessary.

See also

Document Tags and Contributors

 Contributors to this page: Sheppy, jswisher, trevorh, fscholz, Smi, Sevenspade, Nickolay
 Last updated by: Sheppy,