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 { setupFullStory } from './tools/fullstory';
|
||||
import { setupServiceWoker } from './serviceworker';
|
||||
import { IMetaObject, setupMetaInformation } from './meta';
|
||||
|
||||
export interface IWebSetupConstructorOptions {
|
||||
googleAnalyticsCode?: string;
|
||||
fsCode?: string;
|
||||
metaObject: IMetaObject;
|
||||
serviceworker?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* the main WebSetup class
|
||||
*/
|
||||
export class WebSetup {
|
||||
public options: IWebSetupConstructorOptions;
|
||||
constructor(optionsArg: IWebSetupConstructorOptions) {
|
||||
// most important, lets get the meta information in place
|
||||
this.setup(optionsArg);
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
async setup(optionsArg: IWebSetupConstructorOptions) {
|
||||
await setupMetaInformation(optionsArg.metaObject);
|
||||
public async setup() {
|
||||
await setupMetaInformation(this.options.metaObject);
|
||||
|
||||
if (optionsArg.serviceworker) {
|
||||
await setupServiceWoker();
|
||||
if (this.options.googleAnalyticsCode) {
|
||||
await setupGoogleAnalytics(this.options.googleAnalyticsCode);
|
||||
}
|
||||
|
||||
if (optionsArg.googleAnalyticsCode) {
|
||||
await setupGoogleAnalytics(optionsArg.googleAnalyticsCode);
|
||||
}
|
||||
|
||||
if (optionsArg.fsCode) {
|
||||
await setupFullStory(optionsArg.fsCode);
|
||||
if (this.options.fsCode) {
|
||||
await setupFullStory(this.options.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