MCPcopy
hub / github.com/dvanoni/notero / init

Method init

src/content/prefs/preferences.tsx:63–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61 private pageTitleFormatMenu!: XUL.MenuListElement;
62
63 public async init(): Promise<void> {
64 await Zotero.uiReadyPromise;
65
66 this.eventManager = getGlobalNotero().eventManager;
67 this.notionAuthManager = getGlobalNotero().notionAuthManager;
68
69 /* oxlint-disable typescript/no-non-null-assertion */
70 this.notionConnectionContainer = getXULElementById(
71 'notero-notionConnection-container',
72 )!;
73 this.notionConnectionSpinner = getXULElementById(
74 'notero-notionConnection-spinner',
75 )!;
76 this.notionConnectButton = getXULElementById('notero-notionConnect')!;
77 this.notionDisconnectButton = getXULElementById('notero-notionDisconnect')!;
78 this.notionUpgradeConnectionButton = getXULElementById(
79 'notero-notionUpgradeConnection',
80 )!;
81 this.notionDatabaseMenu = getXULElementById('notero-notionDatabase')!;
82 this.notionError = getXULElementById('notero-notionError')!;
83 this.notionTokenContainer = getXULElementById(
84 'notero-notionToken-container',
85 )!;
86 this.notionWorkspaceLabel = getXULElementById('notero-notionWorkspace')!;
87 this.pageTitleFormatMenu = getXULElementById('notero-pageTitleFormat')!;
88 /* oxlint-enable typescript/no-non-null-assertion */
89
90 /* oxlint-disable typescript/no-misused-promises */
91 this.notionConnectButton.addEventListener('command', this.connectNotion);
92 this.notionDisconnectButton.addEventListener(
93 'command',
94 this.disconnectNotion,
95 );
96 this.notionUpgradeConnectionButton.addEventListener(
97 'command',
98 this.upgradeNotionConnection,
99 );
100 this.notionTokenContainer.addEventListener('input', this.handleTokenInput);
101 /* oxlint-enable typescript/no-misused-promises */
102
103 window.addEventListener('unload', () => {
104 this.deinit();
105 });
106
107 await this.initPageTitleFormatMenu();
108 await this.initSyncConfigsTable();
109
110 // Don't block window from loading while waiting for network responses
111 setTimeout(() => {
112 void this.refreshNotionConnectionSection();
113 }, 100);
114
115 this.eventManager.addListener(
116 'notion-connection.add',
117 this.handleNotionConnectionAdd,
118 );
119 }
120

Callers

nothing calls this directly

Calls 7

deinitMethod · 0.95
initSyncConfigsTableMethod · 0.95
getGlobalNoteroFunction · 0.90
getXULElementByIdFunction · 0.90
addListenerMethod · 0.80

Tested by

no test coverage detected