File tree Expand file tree Collapse file tree 4 files changed +31
-3
lines changed
Expand file tree Collapse file tree 4 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 1+ export interface Cleanable {
2+ clean ( ) : void ;
3+ }
Original file line number Diff line number Diff line change @@ -34,6 +34,23 @@ export class TestViewModelStoreImpl extends AbstractViewModelStore {
3434}
3535
3636describe ( 'AbstractViewModelStore' , ( ) => {
37+ it ( 'has clean method' , ( ) => {
38+ const vmStore = new TestViewModelStoreImpl ( ) ;
39+ expect ( vmStore . clean ) . toBeDefined ( ) ;
40+ } ) ;
41+ it ( 'has dispose method' , ( ) => {
42+ const vmStore = new TestViewModelStoreImpl ( ) ;
43+ expect ( vmStore . dispose ) . toBeDefined ( ) ;
44+ } ) ;
45+ it ( 'has attach method' , ( ) => {
46+ const vmStore = new TestViewModelStoreImpl ( ) ;
47+ expect ( vmStore . attach ) . toBeDefined ( ) ;
48+ } ) ;
49+ it ( 'has createViewModel method' , ( ) => {
50+ const vmStore = new TestViewModelStoreImpl ( ) ;
51+ expect ( vmStore . createViewModel ) . toBeDefined ( ) ;
52+ } ) ;
53+
3754 it ( 'create instance' , ( ) => {
3855 const vmStore = new TestViewModelStoreImpl ( ) ;
3956 expect ( vmStore ) . toBeDefined ( ) ;
Original file line number Diff line number Diff line change @@ -177,6 +177,10 @@ export abstract class AbstractViewModelStore<
177177 return ! ! id && this . viewModels . has ( id ) && ! this . mountingViews . has ( id ) ;
178178 }
179179
180+ clean ( ) : void {
181+ this . dispose ( ) ;
182+ }
183+
180184 dispose ( ) : void {
181185 this . viewModels . clear ( ) ;
182186 this . viewModelsByClasses . clear ( ) ;
Original file line number Diff line number Diff line change 1- import { Disposable } from 'disposer-util' ;
2-
1+ import { Cleanable } from '../utils/cleanable' ;
32import { Class , Maybe } from '../utils/types' ;
43
54import {
@@ -13,7 +12,7 @@ import { AnyViewModel } from './view-model.types';
1312 * It extends the Disposable interface, allowing for cleanup of resources.
1413 */
1514export interface ViewModelStore < VMBase extends AnyViewModel = AnyViewModel >
16- extends Disposable {
15+ extends Cleanable {
1716 /**
1817 * Retrieves the ID of a view model based on a given ID or class type.
1918 * @param idOrClass - The ID or class type of the view model.
@@ -78,4 +77,9 @@ export interface ViewModelStore<VMBase extends AnyViewModel = AnyViewModel>
7877 generateViewModelId < VM extends VMBase > (
7978 config : ViewModelGenerateIdConfig < VM > ,
8079 ) : string ;
80+
81+ /**
82+ * @deprecated Please use {clean()} method
83+ */
84+ dispose ( ) : void ;
8185}
You can’t perform that action at this time.
0 commit comments