mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Add destroy to reactive-dict
This will clear the dict and unregister the dict for migration.
This commit is contained in:
@@ -4,8 +4,11 @@ ReactiveDict._migratedDictData = {}; // name -> data
|
||||
ReactiveDict._dictsToMigrate = {}; // name -> ReactiveDict
|
||||
|
||||
ReactiveDict._loadMigratedDict = function (dictName) {
|
||||
if (_.has(ReactiveDict._migratedDictData, dictName))
|
||||
return ReactiveDict._migratedDictData[dictName];
|
||||
if (_.has(ReactiveDict._migratedDictData, dictName)) {
|
||||
const data = ReactiveDict._migratedDictData[dictName];
|
||||
delete ReactiveDict._migratedDictData[dictName];
|
||||
return data;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -210,6 +210,13 @@ export class ReactiveDict {
|
||||
}
|
||||
return didRemove;
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.clear();
|
||||
if (this.name && _.has(ReactiveDict._dictsToMigrate, this.name)) {
|
||||
delete ReactiveDict._dictsToMigrate[this.name];
|
||||
}
|
||||
}
|
||||
|
||||
_setObject(object) {
|
||||
_.each(object, (value, key) => {
|
||||
|
||||
Reference in New Issue
Block a user