deep-storage
Advanced tools
Comparing version 2.0.0 to 2.0.2
@@ -8,5 +8,5 @@ import { DeepStorage, UsesDeepStorage } from "./index"; | ||
} | ||
export interface DeepAsyncState<Response> { | ||
export interface DeepAsyncState<Data> { | ||
status: AsyncStatus; | ||
data?: Response; | ||
data?: Data; | ||
error?: any; | ||
@@ -21,3 +21,3 @@ } | ||
run(): Promise<DeepAsyncState<Response>>; | ||
updateResponse(updater: (prevState: Response) => Response): Promise<DeepAsyncState<Response>>; | ||
update(updater: (prevState: Response) => Response): Promise<DeepAsyncState<Response>>; | ||
} | ||
@@ -31,3 +31,3 @@ export declare class AlreadyRunningError extends Error { | ||
run: () => Promise<DeepAsyncState<Response>>; | ||
updateResponse: (updater: (prevState: Response) => Response) => Promise<DeepAsyncState<Response>>; | ||
update: (updater: (prevState: Response) => Response) => Promise<DeepAsyncState<Response>>; | ||
readonly status: AsyncStatus; | ||
@@ -34,0 +34,0 @@ readonly running: boolean; |
@@ -108,3 +108,3 @@ "use strict"; | ||
}); }; | ||
this.updateResponse = function (updater) { return __awaiter(_this, void 0, void 0, function () { | ||
this.update = function (updater) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
@@ -111,0 +111,0 @@ switch (_a.label) { |
{ | ||
"name": "deep-storage", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"description": "Simple observable state management for reactive applications", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -10,11 +10,9 @@ import { DeepStorage, UsesDeepStorage } from "./index"; | ||
export interface DeepAsyncState<Response> { | ||
export interface DeepAsyncState<Data> { | ||
status: AsyncStatus; | ||
data?: Response; | ||
data?: Data; | ||
error?: any; | ||
} | ||
export interface DeepAsync<Response> extends | ||
DeepAsyncState<Response>, | ||
UsesDeepStorage<DeepAsyncState<Response>> { | ||
export interface DeepAsync<Response> extends DeepAsyncState<Response>, UsesDeepStorage<DeepAsyncState<Response>> { | ||
completed: boolean; | ||
@@ -26,3 +24,3 @@ succeeded: boolean; | ||
run(): Promise<DeepAsyncState<Response>>; | ||
updateResponse(updater: (prevState: Response) => Response): Promise<DeepAsyncState<Response>>; | ||
update(updater: (prevState: Response) => Response): Promise<DeepAsyncState<Response>>; | ||
} | ||
@@ -52,3 +50,3 @@ | ||
} | ||
updateResponse = async (updater: (prevState: Response) => Response): Promise<DeepAsyncState<Response>> => { | ||
update = async (updater: (prevState: Response) => Response): Promise<DeepAsyncState<Response>> => { | ||
await this.storage.update( | ||
@@ -59,3 +57,3 @@ (state: DeepAsyncState<Response>) => | ||
status: AsyncStatus.Succeeded, | ||
data: updater(state.data), | ||
data: updater(state.data), | ||
error: undefined | ||
@@ -62,0 +60,0 @@ })); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
213307
1300