Use arrow functions to replace old CoffeeScript => this wrappers
This commit is contained in:
parent
100ea975bd
commit
a3f08c9b51
10 changed files with 176 additions and 212 deletions
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
const ipcMain = require('electron').ipcMain;
|
||||
|
||||
var slice = [].slice;
|
||||
|
@ -30,40 +32,33 @@ var NavigationController = (function() {
|
|||
this.currentIndex++;
|
||||
this.history.push(this.webContents._getURL());
|
||||
}
|
||||
this.webContents.on('navigation-entry-commited', (function(_this) {
|
||||
return function(event, url, inPage, replaceEntry) {
|
||||
var currentEntry;
|
||||
if (_this.inPageIndex > -1 && !inPage) {
|
||||
|
||||
// Navigated to a new page, clear in-page mark.
|
||||
_this.inPageIndex = -1;
|
||||
} else if (_this.inPageIndex === -1 && inPage) {
|
||||
|
||||
// Started in-page navigations.
|
||||
_this.inPageIndex = _this.currentIndex;
|
||||
this.webContents.on('navigation-entry-commited', (event, url, inPage, replaceEntry) => {
|
||||
var currentEntry;
|
||||
if (this.inPageIndex > -1 && !inPage) {
|
||||
// Navigated to a new page, clear in-page mark.
|
||||
this.inPageIndex = -1;
|
||||
} else if (this.inPageIndex === -1 && inPage) {
|
||||
// Started in-page navigations.
|
||||
this.inPageIndex = this.currentIndex;
|
||||
}
|
||||
if (this.pendingIndex >= 0) {
|
||||
// Go to index.
|
||||
this.currentIndex = this.pendingIndex;
|
||||
this.pendingIndex = -1;
|
||||
return this.history[this.currentIndex] = url;
|
||||
} else if (replaceEntry) {
|
||||
// Non-user initialized navigation.
|
||||
return this.history[this.currentIndex] = url;
|
||||
} else {
|
||||
// Normal navigation. Clear history.
|
||||
this.history = this.history.slice(0, this.currentIndex + 1);
|
||||
currentEntry = this.history[this.currentIndex];
|
||||
if ((currentEntry != null ? currentEntry.url : void 0) !== url) {
|
||||
this.currentIndex++;
|
||||
return this.history.push(url);
|
||||
}
|
||||
if (_this.pendingIndex >= 0) {
|
||||
|
||||
// Go to index.
|
||||
_this.currentIndex = _this.pendingIndex;
|
||||
_this.pendingIndex = -1;
|
||||
return _this.history[_this.currentIndex] = url;
|
||||
} else if (replaceEntry) {
|
||||
|
||||
// Non-user initialized navigation.
|
||||
return _this.history[_this.currentIndex] = url;
|
||||
} else {
|
||||
|
||||
// Normal navigation. Clear history.
|
||||
_this.history = _this.history.slice(0, _this.currentIndex + 1);
|
||||
currentEntry = _this.history[_this.currentIndex];
|
||||
if ((currentEntry != null ? currentEntry.url : void 0) !== url) {
|
||||
_this.currentIndex++;
|
||||
return _this.history.push(url);
|
||||
}
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
NavigationController.prototype.loadURL = function(url, options) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue