mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
separating background apis to their own classes
This commit is contained in:
26
src/background/runtime.background.ts
Normal file
26
src/background/runtime.background.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import MainBackground from './main.background';
|
||||
|
||||
export default class RuntimeBackground {
|
||||
private runtime: any;
|
||||
|
||||
constructor(private main: MainBackground) {
|
||||
this.runtime = chrome.runtime;
|
||||
}
|
||||
|
||||
async init() {
|
||||
if (!this.runtime || this.runtime.onInstalled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.runtime.onInstalled.addListener((details: any) => {
|
||||
(window as any).ga('send', {
|
||||
hitType: 'event',
|
||||
eventAction: 'onInstalled ' + details.reason,
|
||||
});
|
||||
|
||||
if (details.reason === 'install') {
|
||||
chrome.tabs.create({ url: 'https://bitwarden.com/browser-start/' });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user