MCPcopy
hub / github.com/callumalpass/tasknotes / onload

Method onload

src/main.ts:275–324  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273 }
274
275 async onload() {
276 // Create the promise and store its resolver
277 this.readyPromise = new Promise((resolve) => {
278 this.resolveReady = resolve;
279 });
280
281 await this.loadSettings();
282 this.performanceProfiler = createTaskNotesPerformanceProfiler({
283 isEnabled: () => this.settings?.enableDebugLogging === true,
284 logger: createTaskNotesLogger({
285 tag: "PerformanceProfiler",
286 isDebugEnabled: () => this.settings?.enableDebugLogging === true,
287 }),
288 });
289
290 this.i18n = createI18nService({
291 initialLocale: this.settings.uiLanguage ?? "system",
292 getSystemLocale: () => this.getSystemUILocale(),
293 });
294
295 this.i18n.on("locale-changed", ({ current }) => {
296 if (!this.initializationComplete) {
297 return;
298 }
299 const languageLabel = this.i18n.getNativeLanguageName(current);
300 new Notice(this.i18n.translate("notices.languageChanged", { language: languageLabel }));
301 this.refreshLocalizedViews();
302 this.commandRegistry?.refreshTranslations();
303 });
304
305 await initializePluginRuntime(this);
306 this.registerTaskNotesFileMenuActions();
307
308 // Start migration check early (before views can be opened)
309 this.migrationPromise = this.performEarlyMigrationCheck();
310
311 initializeCalendarProviders(this);
312 await registerBasesIntegration(this);
313
314 // Defer expensive initialization until layout is ready
315 this.app.workspace.onLayoutReady(() => {
316 void this.initializeAfterLayoutReady();
317 });
318
319 // At the very end of onload, resolve the promise to signal readiness
320 this.resolveReady();
321 this.emitter.trigger(TASKNOTES_RUNTIME_LIFECYCLE_RAW_EVENTS.ready, {
322 timestamp: new Date().toISOString(),
323 });
324 }
325
326 private registerTaskNotesFileMenuActions(): void {
327 this.registerEvent(

Callers

nothing calls this directly

Calls 15

loadSettingsMethod · 0.95
getSystemUILocaleMethod · 0.95
refreshLocalizedViewsMethod · 0.95
createTaskNotesLoggerFunction · 0.90
createI18nServiceFunction · 0.90
initializePluginRuntimeFunction · 0.90
registerBasesIntegrationFunction · 0.90

Tested by

no test coverage detected