Skip to content

Commit

Permalink
change apply to apply factory to get access to vue hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
SchroterQuentin committed Mar 21, 2024
1 parent 15fc783 commit 495ff9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Bones.UI/core/composableFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { INotifyService } from "../abstractions";
import { onCollectionChanged, onEntityChanged } from "../tools";

export class ComposableFactory {
public static get<TDetails>(factory: () => { get(id: string): Promise<TDetails> } & INotifyService<TDetails>, apply?: (entity: TDetails) => void) {
public static get<TDetails>(factory: () => { get(id: string): Promise<TDetails> } & INotifyService<TDetails>, applyFactory?: () => (entity: TDetails) => void) {
return () => {
const apply = applyFactory ? applyFactory() : () => { };
const service = factory();
let subscribersIds: number[] = [];

Expand Down Expand Up @@ -41,8 +42,9 @@ export class ComposableFactory {
}
}

public static getMany<TDetails extends TInfos, TInfos, TFilter>(factory: () => { getMany(filter?: TFilter): Promise<TInfos[]> } & INotifyService<TDetails>, apply?: (entity: TInfos) => void) {
public static getMany<TDetails extends TInfos, TInfos, TFilter>(factory: () => { getMany(filter?: TFilter): Promise<TInfos[]> } & INotifyService<TDetails>, applyFactory?: () => (entity: TInfos) => void) {
return () => {
const apply = applyFactory ? applyFactory() : () => { };
const service = factory();
let subscribersIds: number[] = [];

Expand Down

0 comments on commit 495ff9c

Please sign in to comment.