mozilla
Your Search Results

    remove

    This article is in need of a technical review.

    The NativeWindow object is only available to privileged code running on Firefox for Android, and is intended for use by Firefox for Android add-ons.

    Summary

    NativeWindow.menu.add() adds an item to the main menu in Firefox for Android, returning an ID for the item. To remove the item, use NativeWindow.menu.remove(), passing in the item's ID.

    Syntax

    window.NativeWindow.menu.remove(menuID);

    menuID
    The ID of the item to remove.

    Example

    The following example adds a menu item with the label "Show Toast", which displays a toast notification when clicked:

    function showToast(window) {  
      window.NativeWindow.toast.show("Showing you a toast", "short");  
    }  
     
    var menuID;  
     
    function addMenuItem(window) {  
      menuID = window.NativeWindow.menu.add("Show Toast", null, function(){  
        showToast(window);   
      });  
    }  
     
    function removeMenuItem(window) {  
      window.NativeWindow.menu.remove(menuID);  
    }
    

    See Also

    Document Tags and Contributors

    Contributors to this page: wbamberg, justinpotts
    Last updated by: wbamberg,
    Hide Sidebar