Use const

This commit is contained in:
Jessica Lord 2016-01-14 14:20:06 -08:00
parent ab8908a4af
commit 5412ecdcc1
7 changed files with 87 additions and 100 deletions

View file

@ -1,11 +1,10 @@
var DEPRECATED_EVENTS, WEB_VIEW_EVENTS, dispatchEvent, ipcRenderer, ref, requestId, webFrame,
slice = [].slice;
const ipcRenderer = require('electron').ipcRenderer;
const webFrame = require('electron').webFrame;
ref = require('electron'), ipcRenderer = ref.ipcRenderer, webFrame = ref.webFrame;
var slice = [].slice;
var requestId = 0;
requestId = 0;
WEB_VIEW_EVENTS = {
var WEB_VIEW_EVENTS = {
'load-commit': ['url', 'isMainFrame'],
'did-finish-load': [],
'did-fail-load': ['errorCode', 'errorDescription', 'validatedURL'],
@ -38,11 +37,11 @@ WEB_VIEW_EVENTS = {
'found-in-page': ['result']
};
DEPRECATED_EVENTS = {
var DEPRECATED_EVENTS = {
'page-title-updated': 'page-title-set'
};
dispatchEvent = function() {
var dispatchEvent = function() {
var args, domEvent, eventKey, eventName, f, i, j, len, ref1, webView;
webView = arguments[0], eventName = arguments[1], eventKey = arguments[2], args = 4 <= arguments.length ? slice.call(arguments, 3) : [];
if (DEPRECATED_EVENTS[eventName] != null) {

View file

@ -1,26 +1,23 @@
var AllowTransparencyAttribute, AutosizeAttribute, AutosizeDimensionAttribute, BooleanAttribute, HttpReferrerAttribute, PartitionAttribute, PreloadAttribute, SrcAttribute, UserAgentAttribute, WebViewAttribute, WebViewImpl, a, guestViewInternal, remote, resolveURL, webViewConstants,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
const WebViewImpl = require('./web-view');
const guestViewInternal = require('./guest-view-internal');
const webViewConstants = require('./web-view-constants');
const remote = require('electron').remote;
WebViewImpl = require('./web-view');
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
guestViewInternal = require('./guest-view-internal');
webViewConstants = require('./web-view-constants');
remote = require('electron').remote;
var hasProp = {}.hasOwnProperty;
// Helper function to resolve url set in attribute.
a = document.createElement('a');
var a = document.createElement('a');
resolveURL = function(url) {
var resolveURL = function(url) {
a.href = url;
return a.href;
};
// Attribute objects.
// Default implementation of a WebView attribute.
WebViewAttribute = (function() {
var WebViewAttribute = (function() {
function WebViewAttribute(name, webViewImpl) {
this.name = name;
this.value = webViewImpl.webviewNode[name] || '';
@ -71,7 +68,7 @@ WebViewAttribute = (function() {
})();
// An attribute that is treated as a Boolean.
BooleanAttribute = (function(superClass) {
var BooleanAttribute = (function(superClass) {
extend(BooleanAttribute, superClass);
function BooleanAttribute(name, webViewImpl) {
@ -95,7 +92,7 @@ BooleanAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that specifies whether transparency is allowed in the webview.
AllowTransparencyAttribute = (function(superClass) {
var AllowTransparencyAttribute = (function(superClass) {
extend(AllowTransparencyAttribute, superClass);
function AllowTransparencyAttribute(webViewImpl) {
@ -114,7 +111,7 @@ AllowTransparencyAttribute = (function(superClass) {
})(BooleanAttribute);
// Attribute used to define the demension limits of autosizing.
AutosizeDimensionAttribute = (function(superClass) {
var AutosizeDimensionAttribute = (function(superClass) {
extend(AutosizeDimensionAttribute, superClass);
function AutosizeDimensionAttribute(name, webViewImpl) {
@ -147,7 +144,7 @@ AutosizeDimensionAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that specifies whether the webview should be autosized.
AutosizeAttribute = (function(superClass) {
var AutosizeAttribute = (function(superClass) {
extend(AutosizeAttribute, superClass);
function AutosizeAttribute(webViewImpl) {
@ -161,7 +158,7 @@ AutosizeAttribute = (function(superClass) {
})(BooleanAttribute);
// Attribute representing the state of the storage partition.
PartitionAttribute = (function(superClass) {
var PartitionAttribute = (function(superClass) {
extend(PartitionAttribute, superClass);
function PartitionAttribute(webViewImpl) {
@ -189,7 +186,7 @@ PartitionAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that handles the location and navigation of the webview.
SrcAttribute = (function(superClass) {
var SrcAttribute = (function(superClass) {
extend(SrcAttribute, superClass);
function SrcAttribute(webViewImpl) {
@ -292,7 +289,7 @@ SrcAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute specifies HTTP referrer.
HttpReferrerAttribute = (function(superClass) {
var HttpReferrerAttribute = (function(superClass) {
extend(HttpReferrerAttribute, superClass);
function HttpReferrerAttribute(webViewImpl) {
@ -304,7 +301,7 @@ HttpReferrerAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute specifies user agent
UserAgentAttribute = (function(superClass) {
var UserAgentAttribute = (function(superClass) {
extend(UserAgentAttribute, superClass);
function UserAgentAttribute(webViewImpl) {
@ -316,7 +313,7 @@ UserAgentAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that set preload script.
PreloadAttribute = (function(superClass) {
var PreloadAttribute = (function(superClass) {
extend(PreloadAttribute, superClass);
function PreloadAttribute(webViewImpl) {

View file

@ -1,26 +1,26 @@
'user strict';
var WebViewImpl, deprecate, getNextId, guestViewInternal, ipcRenderer, listener, nextId, ref, registerBrowserPluginElement, registerWebViewElement, remote, useCapture, v8Util, webFrame, webViewConstants,
hasProp = {}.hasOwnProperty,
slice = [].slice;
const deprecate = require('electron').deprecate;
const webFrame = require('electron').webFrame;
const remote = require('electron').remote;
const ipcRenderer = require('electron').ipcRenderer;
ref = require('electron'), deprecate = ref.deprecate, webFrame = ref.webFrame, remote = ref.remote, ipcRenderer = ref.ipcRenderer;
const v8Util = process.atomBinding('v8_util');
const guestViewInternal = require('./guest-view-internal');
const webViewConstants = require('./web-view-constants');
v8Util = process.atomBinding('v8_util');
guestViewInternal = require('./guest-view-internal');
webViewConstants = require('./web-view-constants');
var hasProp = {}.hasOwnProperty;
var slice = [].slice;
// ID generator.
nextId = 0;
var nextId = 0;
getNextId = function() {
var getNextId = function() {
return ++nextId;
};
// Represents the internal state of the WebView node.
WebViewImpl = (function() {
var WebViewImpl = (function() {
function WebViewImpl(webviewNode) {
var shadowRoot;
this.webviewNode = webviewNode;
@ -274,7 +274,7 @@ WebViewImpl = (function() {
})();
// Registers browser plugin <object> custom element.
registerBrowserPluginElement = function() {
var registerBrowserPluginElement = function() {
var proto;
proto = Object.create(HTMLObjectElement.prototype);
proto.createdCallback = function() {
@ -310,7 +310,7 @@ registerBrowserPluginElement = function() {
};
// Registers <webview> custom element.
registerWebViewElement = function() {
var registerWebViewElement = function() {
var createBlockHandler, createNonBlockHandler, i, j, len, len1, m, methods, nonblockMethods, proto;
proto = Object.create(HTMLObjectElement.prototype);
proto.createdCallback = function() {
@ -444,9 +444,9 @@ registerWebViewElement = function() {
return delete proto.attributeChangedCallback;
};
useCapture = true;
var useCapture = true;
listener = function(event) {
var listener = function(event) {
if (document.readyState === 'loading') {
return;
}