Rename checkSameFirmwareVersion to checkSameFirmware (#217)

This commit is contained in:
Paulus Schoutsen 2022-04-12 11:39:21 -07:00 committed by GitHub
parent c90e17a5ff
commit d0efbac292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -409,8 +409,8 @@
be setting the <code>overrides</code> property on be setting the <code>overrides</code> property on
<code>&lt;esp-web-install-button&gt;</code>. The value is an object <code>&lt;esp-web-install-button&gt;</code>. The value is an object
containing a containing a
<code>checkSameFirmwareVersion(manifest, improvInfo)</code> function. <code>checkSameFirmware(manifest, improvInfo)</code> function. The
The <code>manifest</code> parameter is your manifest and <code>manifest</code> parameter is your manifest and
<code>improvInfo</code> is the information returned from Improv: <code>improvInfo</code> is the information returned from Improv:
<code>{ name, firmware, version, chipFamily }</code>. This check is only <code>{ name, firmware, version, chipFamily }</code>. This check is only
called if the device firmware was detected via Improv. called if the device firmware was detected via Improv.
@ -418,7 +418,7 @@
<pre> <pre>
const button = document.querySelector('esp-web-install-button'); const button = document.querySelector('esp-web-install-button');
button.overrides = { button.overrides = {
checkSameFirmwareVersion(manifest, improvInfo) { checkSameFirmware(manifest, improvInfo) {
const manifestFirmware = manifest.name.toLowerCase(); const manifestFirmware = manifest.name.toLowerCase();
const deviceFirmware = improvInfo.firmware.toLowerCase(); const deviceFirmware = improvInfo.firmware.toLowerCase();
return manifestFirmware.includes(deviceFirmware); return manifestFirmware.includes(deviceFirmware);

View File

@ -38,7 +38,7 @@ export class EwtInstallDialog extends LitElement {
public logger: Logger = console; public logger: Logger = console;
public overrides?: { public overrides?: {
checkSameFirmwareVersion?: ( checkSameFirmware?: (
manifest: Manifest, manifest: Manifest,
deviceImprov: ImprovSerial["info"] deviceImprov: ImprovSerial["info"]
) => boolean; ) => boolean;
@ -886,8 +886,8 @@ export class EwtInstallDialog extends LitElement {
private get _isSameFirmware() { private get _isSameFirmware() {
return !this._info return !this._info
? false ? false
: this.overrides?.checkSameFirmwareVersion : this.overrides?.checkSameFirmware
? this.overrides.checkSameFirmwareVersion(this._manifest, this._info) ? this.overrides.checkSameFirmware(this._manifest, this._info)
: this._info.firmware === this._manifest.name; : this._info.firmware === this._manifest.name;
} }