Prevent multiple prepare calls

This commit is contained in:
toasted-nutbread 2020-02-16 12:23:40 -05:00
parent b5d32c73e6
commit 6df5220e02

View File

@ -29,12 +29,16 @@ class DisplayFloat extends Display {
}; };
this._orphaned = false; this._orphaned = false;
this._prepareInvoked = false;
yomichan.on('orphaned', () => this.onOrphaned()); yomichan.on('orphaned', () => this.onOrphaned());
window.addEventListener('message', (e) => this.onMessage(e), false); window.addEventListener('message', (e) => this.onMessage(e), false);
} }
async prepare(options, popupInfo, url, childrenSupported, scale, uniqueId) { async prepare(options, popupInfo, url, childrenSupported, scale, uniqueId) {
if (this._prepareInvoked) { return; }
this._prepareInvoked = true;
await super.prepare(options); await super.prepare(options);
const {id, depth, parentFrameId} = popupInfo; const {id, depth, parentFrameId} = popupInfo;