Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Moving cloneTemplate to abr-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
brrd committed Apr 26, 2016
1 parent a642a9e commit bca016d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/abr-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ function exportHtmlMenuGenerator (submenu, config) {
// Electron's menu wrapper
function AbrMenu (abrApp, abrWin, menuTemplate, config) {
this.abrWin = abrWin;
var preprocessedMenuTemplate = preprocessTemplate(abrApp, menuTemplate, config);
var cloneTemplate = JSON.parse(JSON.stringify(menuTemplate)); // Electron modifies the template while building the menu so we need to clone it before
var preprocessedMenuTemplate = preprocessTemplate(abrApp, cloneTemplate, config);
this.menu = Menu.buildFromTemplate(preprocessedMenuTemplate);
}

Expand Down
3 changes: 1 addition & 2 deletions app/abr-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ function AbrWindow (abrApp, path) {
}
}
this.config = createConfig();
var cloneTemplate = JSON.parse(JSON.stringify(menuTemplate)); // Electron modifies the template while building the menu so we need to clone it before
this.menu = new AbrMenu(abrApp, this, cloneTemplate, this.config);
this.menu = new AbrMenu(abrApp, this, menuTemplate, this.config);
// Context
this.contextMenu = new AbrMenu(abrApp, this, contextMenuTemplate, this.config);
this.open();
Expand Down

0 comments on commit bca016d

Please # to comment.