Teardown - BaseTreatment
Tue Feb 28 2023 23:02:34 GMT+0000 (Coordinated Universal Time)
Saved by
@markporo
#teardown
#base
#treatment
import BaseTreatment, { teardownWithOptimizelyPages } from 'cromedics/classes/BaseTreatment';
import { pages } from 'optimizely.json';
class BasicTreatment extends BaseTreatment {
constructor(variation) {
super();
this.variation = variation;
teardownWithOptimizelyPages(this, pages);
}
apply() {
super.apply();
this.applyClass(TAG + this.variation);
// code here
// use this.variation to access variation variable
//
}
teardown() {
super.teardown();
}
}
SHARED.applyTreatment = (variation) => {
SHARED.treatment = SHARED.treatment || (SHARED.treatment = new BasicTreatment(variation));
SHARED.treatment.on();
};
content_copyCOPY
Comments