Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
27
Frontend-Learner/node_modules/on-change/source/smart-clone/clone/clone-weakmap.js
generated
vendored
Normal file
27
Frontend-Learner/node_modules/on-change/source/smart-clone/clone/clone-weakmap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import CloneObject from './clone-object.js';
|
||||
|
||||
export default class CloneWeakMap extends CloneObject {
|
||||
constructor(value, path, argumentsList, hasOnValidate) {
|
||||
super(undefined, path, argumentsList, hasOnValidate);
|
||||
|
||||
this._weakKey = argumentsList[0];
|
||||
this._weakHas = value.has(this._weakKey);
|
||||
this._weakValue = value.get(this._weakKey);
|
||||
}
|
||||
|
||||
isChanged(value, _equals) {
|
||||
return this._weakValue !== value.get(this._weakKey);
|
||||
}
|
||||
|
||||
undo(object) {
|
||||
const weakHas = object.has(this._weakKey);
|
||||
|
||||
if (this._weakHas && !weakHas) {
|
||||
object.set(this._weakKey, this._weakValue);
|
||||
} else if (!this._weakHas && weakHas) {
|
||||
object.delete(this._weakKey);
|
||||
} else if (this._weakValue !== object.get(this._weakKey)) {
|
||||
object.set(this._weakKey, this._weakValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue