build: fix new TS linting errors (#17279)
* remove unused _args var * handle type/variable shadowing
This commit is contained in:
parent
2be62b1c33
commit
61fc95417b
2 changed files with 12 additions and 8 deletions
|
@ -11,9 +11,13 @@ const resolveURL = function (url?: string | null) {
|
|||
return a.href
|
||||
}
|
||||
|
||||
interface MutationHandler {
|
||||
handleMutation (_oldValue: any, _newValue: any): any;
|
||||
}
|
||||
|
||||
// Attribute objects.
|
||||
// Default implementation of a WebView attribute.
|
||||
class WebViewAttribute {
|
||||
class WebViewAttribute implements MutationHandler {
|
||||
public value: any;
|
||||
public ignoreMutation = false;
|
||||
|
||||
|
@ -55,7 +59,7 @@ class WebViewAttribute {
|
|||
}
|
||||
|
||||
// Called when the attribute's value changes.
|
||||
public handleMutation (..._args: Array<any>): any {}
|
||||
public handleMutation: MutationHandler['handleMutation'] = () => undefined as any
|
||||
}
|
||||
|
||||
// An attribute that is treated as a Boolean.
|
||||
|
@ -81,7 +85,7 @@ class PartitionAttribute extends WebViewAttribute {
|
|||
super(WEB_VIEW_CONSTANTS.ATTRIBUTE_PARTITION, webViewImpl)
|
||||
}
|
||||
|
||||
public handleMutation (oldValue: any, newValue: any) {
|
||||
public handleMutation = (oldValue: any, newValue: any) => {
|
||||
newValue = newValue || ''
|
||||
|
||||
// The partition cannot change if the webview has already navigated.
|
||||
|
@ -124,7 +128,7 @@ class SrcAttribute extends WebViewAttribute {
|
|||
this.observer.takeRecords()
|
||||
}
|
||||
|
||||
public handleMutation (oldValue: any, newValue: any) {
|
||||
public handleMutation = (oldValue: any, newValue: any) => {
|
||||
// Once we have navigated, we don't allow clearing the src attribute.
|
||||
// Once <webview> enters a navigated state, it cannot return to a
|
||||
// placeholder state.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// modules must be passed from outside, all included files must be plain JS.
|
||||
|
||||
import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants'
|
||||
import { WebViewImpl, webViewImplModule } from '@electron/internal/renderer/web-view/web-view-impl'
|
||||
import { WebViewImpl as IWebViewImpl, webViewImplModule } from '@electron/internal/renderer/web-view/web-view-impl'
|
||||
|
||||
// Return a WebViewElement class that is defined in this context.
|
||||
const defineWebViewElement = (v8Util: NodeJS.V8UtilBinding, webViewImpl: typeof webViewImplModule) => {
|
||||
|
@ -41,7 +41,7 @@ const defineWebViewElement = (v8Util: NodeJS.V8UtilBinding, webViewImpl: typeof
|
|||
}
|
||||
|
||||
connectedCallback () {
|
||||
const internal = v8Util.getHiddenValue<WebViewImpl>(this, 'internal')
|
||||
const internal = v8Util.getHiddenValue<IWebViewImpl>(this, 'internal')
|
||||
if (!internal) {
|
||||
return
|
||||
}
|
||||
|
@ -53,14 +53,14 @@ const defineWebViewElement = (v8Util: NodeJS.V8UtilBinding, webViewImpl: typeof
|
|||
}
|
||||
|
||||
attributeChangedCallback (name: string, oldValue: any, newValue: any) {
|
||||
const internal = v8Util.getHiddenValue<WebViewImpl>(this, 'internal')
|
||||
const internal = v8Util.getHiddenValue<IWebViewImpl>(this, 'internal')
|
||||
if (internal) {
|
||||
internal.handleWebviewAttributeMutation(name, oldValue, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
disconnectedCallback () {
|
||||
const internal = v8Util.getHiddenValue<WebViewImpl>(this, 'internal')
|
||||
const internal = v8Util.getHiddenValue<IWebViewImpl>(this, 'internal')
|
||||
if (!internal) {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue