websetup/ts/index.ts

37 lines
971 B
TypeScript
Raw Normal View History

2018-12-27 23:23:13 +00:00
import * as plugins from './websetup.plugins';
2019-03-25 14:57:38 +00:00
import { setupGoogleAnalytics } from './tools/ganalytics';
2019-03-25 15:07:04 +00:00
import { setupFullStory } from './tools/fullstory';
2019-03-27 13:38:24 +00:00
import { setupServiceWoker } from './serviceworker';
import { IMetaObject, setupMetaInformation } from './meta';
2019-03-25 14:57:38 +00:00
export interface IWebSetupConstructorOptions {
googleAnalyticsCode?: string;
fsCode?: string;
2019-03-27 13:38:24 +00:00
metaObject: IMetaObject;
serviceworker?: boolean;
2019-03-25 14:57:38 +00:00
}
/**
* the main WebSetup class
*/
export class WebSetup {
constructor(optionsArg: IWebSetupConstructorOptions) {
2019-03-27 13:38:24 +00:00
// most important, lets get the meta information in place
this.setup(optionsArg);
}
async setup(optionsArg: IWebSetupConstructorOptions) {
if(optionsArg.serviceworker) {
await setupServiceWoker()
}
2019-03-25 14:57:38 +00:00
if (optionsArg.googleAnalyticsCode) {
2019-03-27 13:38:24 +00:00
await setupGoogleAnalytics(optionsArg.googleAnalyticsCode);
2019-03-25 14:57:38 +00:00
}
2019-03-25 15:07:04 +00:00
if (optionsArg.fsCode) {
2019-03-27 13:38:24 +00:00
await setupFullStory(optionsArg.fsCode)
2019-03-25 14:57:38 +00:00
}
}
}