@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
40 lines (38 loc) • 956 B
JavaScript
import { of } from 'rxjs';
import { DataStore } from './data-store';
/**
* Defines a single value data store using memory as the backing store
* Semantically this is now different than managing a local variable,
* however it can be used anywhere a dataStore is accepted.
* It also has usefulness for testing classes that use a DataStore
*/
export class MemoryDataStore extends DataStore {
data;
/**
* Initializes a new instance of DataStore<T>
*/
constructor() {
super();
}
/**
* Implementation to get the stored data
*/
getData() {
return of(this.data);
}
/**
* Implementation to set the stored data
*/
setData(data) {
this.data = data;
return of(null);
}
/**
* Implementation to clear the stored data
*/
clearData() {
this.data = undefined;
return of(null);
}
}
//# sourceMappingURL=memory-data-store.js.map