mozilla
Your Search Results

    fuelIAnnotations

    The annotation service is designed to store arbitrary data about a web page in Firefox 3

    Method overview

    boolean has(in AString aName)
    nsIVariant get(in AString aName)
    void set(in AString aName, in nsIVariant aValue, in PRInt32 aExpiration)
    void remove(in AString aName)

    Attributes

    Attribute Type Description
    names readonly attribute nsIVariant Array of the annotation names associated with the owning item

    Methods

    has()

    Determines if an annotation exists with the given name.

    boolean has(in AString aName)
    

    Parameters

    aName
    The name of the annotation

    Return value

    true if an annotation exists with the given name, false otherwise.

    get()

    Gets the value of an annotation with the given name.

    nsIVariant get(in AString aName)
    

    Parameters

    aName
    The name of the annotation

    Return value

    A variant containing the value of the annotation. Supports string, boolean and number.

    set()

    Sets the value of an annotation with the given name.

    void set(in AString aName, in nsIVariant aValue, in PRInt32 aExpiration)
    

    Parameters

    aName
    The name of the annotation
    aValue
    The new value of the annotation. Supports string, boolean and number.
    aExpiration
    The expiration policy for the annotation. See nsIAnnotationService.

    Return value

    remove()

    Removes the named annotation from the owner item.

    void remove(in AString aName)
    

    Parameters

    aName
    The name of annotation.

    Return value

    Examples

    const NEVER_EXPIRE = 0;
    
    function url(spec) {
      var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
      return ios.newURI(spec, null, null);
    }
    
    var bookmark = Application.bookmarks.menu.addBookmark("Mozilla", url("http://www.mozilla.com/"));
    bookmark.annotations.set("mystuff/public", true, NEVER_EXPIRE);
    bookmark.annotations.set("mystuff/rating", 5, NEVER_EXPIRE);
    
    alert(bookmark.annotations.get("mystuff/rating"));
    
    bookmark.annotations.remove("mystuff/rating");
    

    See also

    Document Tags and Contributors

    Contributors to this page: Sheppy, Hamstersoup, MarkFinkle, Gomita, trevorh, Mgjbot, Potappo
    Last updated by: Sheppy,