Isolate objects to background window

This commit is contained in:
toasted-nutbread 2019-09-17 21:23:21 -04:00
parent dcfe722ba6
commit 352d214203
2 changed files with 13 additions and 3 deletions

View File

@ -56,6 +56,11 @@ ConditionsUI.Container = class Container {
// Override // Override
} }
isolate(object) {
// Override
return object;
}
remove(child) { remove(child) {
const index = this.children.indexOf(child); const index = this.children.indexOf(child);
if (index < 0) { if (index < 0) {
@ -68,9 +73,9 @@ ConditionsUI.Container = class Container {
} }
onAddConditionGroup() { onAddConditionGroup() {
const conditionGroup = { const conditionGroup = this.isolate({
conditions: [this.createDefaultCondition(this.conditionNameDefault)] conditions: [this.createDefaultCondition(this.conditionNameDefault)]
}; });
this.conditionGroups.push(conditionGroup); this.conditionGroups.push(conditionGroup);
this.save(); this.save();
this.children.push(new ConditionsUI.ConditionGroup(this, conditionGroup)); this.children.push(new ConditionsUI.ConditionGroup(this, conditionGroup));
@ -139,6 +144,10 @@ ConditionsUI.ConditionGroup = class ConditionGroup {
this.parent.save(); this.parent.save();
} }
isolate(object) {
return this.parent.isolate(object);
}
remove(child) { remove(child) {
const index = this.children.indexOf(child); const index = this.children.indexOf(child);
if (index < 0) { if (index < 0) {
@ -155,7 +164,7 @@ ConditionsUI.ConditionGroup = class ConditionGroup {
} }
onAddCondition() { onAddCondition() {
const condition = this.parent.createDefaultCondition(this.parent.conditionNameDefault); const condition = this.isolate(this.parent.createDefaultCondition(this.parent.conditionNameDefault));
this.conditionGroup.conditions.push(condition); this.conditionGroup.conditions.push(condition);
this.children.push(new ConditionsUI.Condition(this, condition)); this.children.push(new ConditionsUI.Condition(this, condition));
} }

View File

@ -98,6 +98,7 @@ async function profileFormWrite(optionsFull) {
apiOptionsSave(); apiOptionsSave();
conditionsClearCaches(profileConditionsDescriptor); conditionsClearCaches(profileConditionsDescriptor);
}; };
profileConditionsContainer.isolate = utilBackgroundIsolate;
} }
function profileOptionsPopulateSelect(select, profiles, currentValue, ignoreIndices) { function profileOptionsPopulateSelect(select, profiles, currentValue, ignoreIndices) {