MCPcopy Index your code
hub / github.com/OneNoteDev/WebClipper / constructor

Function constructor

src/scripts/extensions/extensionWorkerBase.ts:63–92  ·  view source on GitHub ↗
(clientInfo: SmartValue<ClientInfo>, auth: AuthenticationHelper, clipperData: ClipperData, uiMessageHandlerThunk: () => MessageHandler, injectMessageHandlerThunk: () => MessageHandler)

Source from the content-addressed store, hash-verified

61 protected sessionId: SmartValue<string>;
62
63 constructor(clientInfo: SmartValue<ClientInfo>, auth: AuthenticationHelper, clipperData: ClipperData, uiMessageHandlerThunk: () => MessageHandler, injectMessageHandlerThunk: () => MessageHandler) {
64 Polyfills.init();
65
66 this.onUnloading = () => { };
67
68 this.uiCommunicator = new Communicator(uiMessageHandlerThunk(), Constants.CommunicationChannels.extensionAndUi);
69 this.pageNavUiCommunicator = new Communicator(uiMessageHandlerThunk(), Constants.CommunicationChannels.extensionAndPageNavUi);
70 this.debugLoggingInjectCommunicator = new Communicator(injectMessageHandlerThunk(), Constants.CommunicationChannels.debugLoggingInjectedAndExtension);
71 this.injectCommunicator = new Communicator(injectMessageHandlerThunk(), Constants.CommunicationChannels.injectedAndExtension);
72 this.pageNavInjectCommunicator = new Communicator(injectMessageHandlerThunk(), Constants.CommunicationChannels.pageNavInjectedAndExtension);
73
74 this.sessionId = new SmartValue<string>();
75 this.logger = LogManager.createExtLogger(this.sessionId, LogHelpers.isConsoleOutputEnabled() ? this.debugLoggingInjectCommunicator : undefined);
76 this.logger.logSessionStart();
77
78 this.clipperData = clipperData;
79 this.clipperData.setLogger(this.logger);
80
81 this.auth = auth;
82 this.clientInfo = clientInfo;
83
84 // TODO Remove this function after ~some~ amount of time has passed
85 // This is a temporary event shipping with v3.2.0 that is needed to map
86 // the "accidental" device ids we were logging (that came from a cookie)
87 // to the "real" device ids (ON-xxx) found in local storage that we weren't logging
88 this.logDeviceIdMapEvent();
89
90 this.initializeCommunicators();
91 this.initializeContextProperties();
92 }
93
94 private initializeContextProperties() {
95 let clientInfo = this.clientInfo.get();

Callers

nothing calls this directly

Calls 4

initMethod · 0.65
logSessionStartMethod · 0.45
setLoggerMethod · 0.45

Tested by

no test coverage detected