You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
!(function () { |
|
Report = { |
|
SessionMgr: { |
|
get() { |
|
return ''; |
|
}, |
|
}, |
|
}; |
|
let target = null; |
|
const targetStack = []; |
|
|
|
function pushTarget (_target) { |
|
if (target) { |
|
targetStack.push(target); |
|
} |
|
Fix.Model.target = target = _target; |
|
} |
|
|
|
function popTarget () { |
|
Fix.Model.target = target = targetStack.pop(); |
|
} |
|
|
|
Fix.Test = { |
|
makeContext: (state, fn) => { |
|
const Store = BI.inherit(Fix.Model, { |
|
state, |
|
childContext: Object.keys(state), |
|
}); |
|
const store = new Store(); |
|
pushTarget(store); |
|
fn(store); |
|
popTarget(); |
|
|
|
return store; |
|
}, |
|
extractContext: (model, contextList) => { |
|
BI.each(BI.deepClone(model), key => { |
|
if (BI.contains(contextList, key)) { |
|
return; |
|
} |
|
|
|
delete model[key]; |
|
}); |
|
|
|
return model; |
|
}, |
|
}; |
|
}());
|
|
|