Mark private members

This commit is contained in:
toasted-nutbread 2019-12-15 17:07:19 -05:00
parent 8a127e07f3
commit 2c3a145866

View File

@ -19,10 +19,10 @@
class PopupProxyHost { class PopupProxyHost {
constructor() { constructor() {
this.popups = new Map(); this._popups = new Map();
this.nextId = 0; this._nextId = 0;
this.apiReceiver = null; this._apiReceiver = null;
this.frameIdPromise = null; this._frameIdPromise = null;
} }
// Public functions // Public functions
@ -34,11 +34,11 @@ class PopupProxyHost {
} }
async prepare() { async prepare() {
this.frameIdPromise = apiFrameInformationGet(); this._frameIdPromise = apiFrameInformationGet();
const {frameId} = await this.frameIdPromise; const {frameId} = await this._frameIdPromise;
if (typeof frameId !== 'number') { return; } if (typeof frameId !== 'number') { return; }
this.apiReceiver = new FrontendApiReceiver(`popup-proxy-host#${frameId}`, new Map([ this._apiReceiver = new FrontendApiReceiver(`popup-proxy-host#${frameId}`, new Map([
['createNestedPopup', ({parentId}) => this._onApiCreateNestedPopup(parentId)], ['createNestedPopup', ({parentId}) => this._onApiCreateNestedPopup(parentId)],
['setOptions', ({id, options}) => this._onApiSetOptions(id, options)], ['setOptions', ({id, options}) => this._onApiSetOptions(id, options)],
['hide', ({id, changeFocus}) => this._onApiHide(id, changeFocus)], ['hide', ({id, changeFocus}) => this._onApiHide(id, changeFocus)],
@ -52,18 +52,18 @@ class PopupProxyHost {
} }
createPopup(parentId, depth) { createPopup(parentId, depth) {
const parent = (typeof parentId === 'string' && this.popups.has(parentId) ? this.popups.get(parentId) : null); const parent = (typeof parentId === 'string' && this._popups.has(parentId) ? this._popups.get(parentId) : null);
const id = `${this.nextId}`; const id = `${this._nextId}`;
if (parent !== null) { if (parent !== null) {
depth = parent.depth + 1; depth = parent.depth + 1;
} }
++this.nextId; ++this._nextId;
const popup = new Popup(id, depth, this.frameIdPromise); const popup = new Popup(id, depth, this._frameIdPromise);
if (parent !== null) { if (parent !== null) {
popup.parent = parent; popup.parent = parent;
parent.child = popup; parent.child = popup;
} }
this.popups.set(id, popup); this._popups.set(id, popup);
return popup; return popup;
} }
@ -118,7 +118,7 @@ class PopupProxyHost {
// Private functions // Private functions
_getPopup(id) { _getPopup(id) {
const popup = this.popups.get(id); const popup = this._popups.get(id);
if (typeof popup === 'undefined') { if (typeof popup === 'undefined') {
throw new Error('Invalid popup ID'); throw new Error('Invalid popup ID');
} }