BREAKING CHANGE(core): remove serviceworker
This commit is contained in:
parent
c748c5102c
commit
5496c8c482
22
ts/index.ts
22
ts/index.ts
@ -2,38 +2,32 @@ import * as plugins from './websetup.plugins';
|
|||||||
|
|
||||||
import { setupGoogleAnalytics } from './tools/ganalytics';
|
import { setupGoogleAnalytics } from './tools/ganalytics';
|
||||||
import { setupFullStory } from './tools/fullstory';
|
import { setupFullStory } from './tools/fullstory';
|
||||||
import { setupServiceWoker } from './serviceworker';
|
|
||||||
import { IMetaObject, setupMetaInformation } from './meta';
|
import { IMetaObject, setupMetaInformation } from './meta';
|
||||||
|
|
||||||
export interface IWebSetupConstructorOptions {
|
export interface IWebSetupConstructorOptions {
|
||||||
googleAnalyticsCode?: string;
|
googleAnalyticsCode?: string;
|
||||||
fsCode?: string;
|
fsCode?: string;
|
||||||
metaObject: IMetaObject;
|
metaObject: IMetaObject;
|
||||||
serviceworker?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the main WebSetup class
|
* the main WebSetup class
|
||||||
*/
|
*/
|
||||||
export class WebSetup {
|
export class WebSetup {
|
||||||
|
public options: IWebSetupConstructorOptions;
|
||||||
constructor(optionsArg: IWebSetupConstructorOptions) {
|
constructor(optionsArg: IWebSetupConstructorOptions) {
|
||||||
// most important, lets get the meta information in place
|
this.options = optionsArg;
|
||||||
this.setup(optionsArg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async setup(optionsArg: IWebSetupConstructorOptions) {
|
public async setup() {
|
||||||
await setupMetaInformation(optionsArg.metaObject);
|
await setupMetaInformation(this.options.metaObject);
|
||||||
|
|
||||||
if (optionsArg.serviceworker) {
|
if (this.options.googleAnalyticsCode) {
|
||||||
await setupServiceWoker();
|
await setupGoogleAnalytics(this.options.googleAnalyticsCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionsArg.googleAnalyticsCode) {
|
if (this.options.fsCode) {
|
||||||
await setupGoogleAnalytics(optionsArg.googleAnalyticsCode);
|
await setupFullStory(this.options.fsCode);
|
||||||
}
|
|
||||||
|
|
||||||
if (optionsArg.fsCode) {
|
|
||||||
await setupFullStory(optionsArg.fsCode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
export const setupServiceWoker = async () => {
|
|
||||||
// serviceworker
|
|
||||||
const script = document.createElement('script');
|
|
||||||
script.onload = () => {
|
|
||||||
console.log(
|
|
||||||
'Loaded Serviceworker. The serviceworker helps us with notifications and offline capabilities, so you can also read this site when your device is offline.'
|
|
||||||
);
|
|
||||||
};
|
|
||||||
script.src = 'serviceworker/mainthread.js';
|
|
||||||
document.head.appendChild(script);
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user