src/menu.js
function addItem(item = {}) {
    if (!item.id) {
        console.warn('Cannot add menuitem. A unique identifier is required for the menuitem to work correctly.');
        return;
    }
    let el = doc.createElement('menuItem');
    // assign unique id
    item.attributes = _.assign({}, item.attributes, {
        id: item.id
    });
    // add all attributes
    setAttributes(el, item.attributes);
    // add title
    el.innerHTML = `<title>${(_.isFunction(item.name) ? item.name() : item.name)}</title>`;
    // add page reference
    el.page = item.page;
    // appends to the menu
    menuBarEl.insertBefore(el, null);
    // cache for later use
    itemsCache[item.id] = el;

    return el;
}
function addItem(item = {}) {
    if (!item.id) {
        console.warn('Cannot add menuitem. A unique identifier is required for the menuitem to work correctly.');
        return;
    }
    let el = doc.createElement('menuItem');
    // assign unique id
    item.attributes = _.assign({}, item.attributes, {
        id: item.id
    });
    // add all attributes
    setAttributes(el, item.attributes);
    // add title
    el.innerHTML = `<title>${(_.isFunction(item.name) ? item.name() : item.name)}</title>`;
    // add page reference
    el.page = item.page;
    // appends to the menu
    menuBarEl.insertBefore(el, null);
    // cache for later use
    itemsCache[item.id] = el;

    return el;
}
function addItem ( item = { } ) { if ( ! item . id ) { console . warn ( 'Cannot add menuitem. A unique identifier is required for the menuitem to work correctly.' ) ; return ; } let el = doc . createElement ( 'menuItem' ) ; // assign unique id item . attributes = _ . assign ( { } , item . attributes , { id : item . id } ) ; // add all attributes setAttributes ( el , item . attributes ) ; // add title el . innerHTML = ` ${ ( _ . isFunction ( item . name ) ? item . name ( ) : item . name ) } ` ; // add page reference el . page = item . page ; // appends to the menu menuBarEl . insertBefore ( el , null ) ; // cache for later use itemsCache [ item . id ] = el ; return el ; }
Adds menu item to the menu document.

@private

@param {Object} item 	The configuration realted to the menu item.
Adds menu item to the menu document .