fix(ampy): 添加 dispose 方法 null 检查防止重复调用报错
This commit is contained in:
@@ -417,12 +417,16 @@ class AmpyExt extends Ampy {
|
|||||||
|
|
||||||
async dispose() {
|
async dispose() {
|
||||||
this.#active_ = false;
|
this.#active_ = false;
|
||||||
|
if (this.#device_) {
|
||||||
await this.#device_.dispose();
|
await this.#device_.dispose();
|
||||||
this.#device_ = null;
|
this.#device_ = null;
|
||||||
|
}
|
||||||
|
if (this.#events_) {
|
||||||
this.#events_.reset();
|
this.#events_.reset();
|
||||||
this.#events_ = null;
|
this.#events_ = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Web.Ampy = AmpyExt;
|
Web.Ampy = AmpyExt;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user