fix(core): update
This commit is contained in:
parent
e47869caed
commit
b8ab19a683
@ -6,6 +6,8 @@ import * as plugins from './websetup.plugins';
|
|||||||
|
|
||||||
export type TBaseLevelType = 'global' | 'base' | 'subpage';
|
export type TBaseLevelType = 'global' | 'base' | 'subpage';
|
||||||
|
|
||||||
|
export type TLevelState = 'enabled' | 'disabled';
|
||||||
|
|
||||||
export class TagLevel {
|
export class TagLevel {
|
||||||
public tagManagerRef: TagManager;
|
public tagManagerRef: TagManager;
|
||||||
|
|
||||||
@ -13,12 +15,17 @@ export class TagLevel {
|
|||||||
public type: TBaseLevelType;
|
public type: TBaseLevelType;
|
||||||
public tags: Tag[] = [];
|
public tags: Tag[] = [];
|
||||||
|
|
||||||
|
public state: TLevelState = 'disabled';
|
||||||
|
|
||||||
constructor(tagManagerRefArg: TagManager, levelType: TBaseLevelType) {
|
constructor(tagManagerRefArg: TagManager, levelType: TBaseLevelType) {
|
||||||
this.tagManagerRef = tagManagerRefArg;
|
this.tagManagerRef = tagManagerRefArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public addTag(tagArg: Tag) {
|
public addTag(tagArg: Tag) {
|
||||||
this.tags.push(tagArg);
|
this.tags.push(tagArg);
|
||||||
|
if (this.state === 'enabled') {
|
||||||
|
tagArg.appendToDom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async addCompanyInfo(companyDataArg: plugins.tsclass.business.ICompany) {
|
public async addCompanyInfo(companyDataArg: plugins.tsclass.business.ICompany) {
|
||||||
@ -63,11 +70,13 @@ export class TagLevel {
|
|||||||
for (const tagArg of this.tags) {
|
for (const tagArg of this.tags) {
|
||||||
tagArg.appendToDom();
|
tagArg.appendToDom();
|
||||||
}
|
}
|
||||||
|
this.state = 'enabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
public async disable() {
|
public async disable() {
|
||||||
for (const tagArg of this.tags) {
|
for (const tagArg of this.tags) {
|
||||||
tagArg.removeFromDom();
|
tagArg.removeFromDom();
|
||||||
}
|
}
|
||||||
|
this.state = 'disabled';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user