jaxs 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jaxs.d.ts CHANGED
@@ -175,7 +175,7 @@ declare type CreateAppBuilderArguments = {
175
175
 
176
176
  declare const createBus: () => {
177
177
  bus: JaxsBus
178
- publish: (event: string, payload: any) => void
178
+ publish: PublishExtended<any>
179
179
  subscribe: (
180
180
  matcher: BusEventMatcher,
181
181
  listener: BusListener<any>,
@@ -263,14 +263,6 @@ declare class FuzzySubscriptions {
263
263
  matches(event: string): FuzzySubscriptionData<any>[]
264
264
  }
265
265
 
266
- declare type GeneralPeriodicOptions = {
267
- period: number
268
- offset?: number
269
- }
270
-
271
- declare type GeneralPeriodicPublisherOptions<T> =
272
- RequiredPeriodicPublisherOptions<T> & GeneralPeriodicOptions
273
-
274
266
  declare type InsertNodeData = {
275
267
  parent: JaxsElement
276
268
  index: number
@@ -396,13 +388,14 @@ export declare namespace JaxsTypes {
396
388
  StoreListSorterFunction,
397
389
  PeriodicPublisher,
398
390
  RequiredPeriodicPublisherOptions,
399
- GeneralPeriodicOptions,
400
391
  CustomPeriodicOptions,
401
- GeneralPeriodicPublisherOptions,
402
392
  CustomPeriodicPublisherOptions,
403
- PublishPeriodicallyOptions,
404
393
  PeriodicTimerFunctionOptions,
405
394
  PeriodicTimerFunction,
395
+ WithTimeoutOptions,
396
+ PeriodicallyOptions,
397
+ PeriodicallyWithCustomTimerOptions,
398
+ PublishExtended,
406
399
  RouteState,
407
400
  RouteMatcher,
408
401
  RenderedRoute,
@@ -460,18 +453,14 @@ export declare const ListStore: {
460
453
  reset: <T>(store: Store<T[]>) => void
461
454
  includes: <T>(store: Store<T[]>, value: T) => boolean
462
455
  appendIfUnique: <T>(store: Store<T[]>, item: T) => void
456
+ findBy: <T>(store: Store<T[]>, matcherFunction: (value: T) => boolean) => T
457
+ replace: <T>(store: Store<T[]>, original: T, replacement: T) => void
463
458
  }
464
459
 
465
460
  declare const locationChangeEvent = 'navigation:location-change'
466
461
 
467
462
  export declare namespace messageBus {
468
- export {
469
- createBus,
470
- JaxsBus,
471
- ExactSubscriptions,
472
- FuzzySubscriptions,
473
- publishPeriodically,
474
- }
463
+ export { createBus, JaxsBus, ExactSubscriptions, FuzzySubscriptions }
475
464
  }
476
465
 
477
466
  declare const navigate: ({
@@ -505,6 +494,17 @@ declare const onLinkClick: (listenerKit: ListenerKit<MouseEvent>) => void
505
494
 
506
495
  declare const onLocationChange: (listenerKit: ListenerKit<null>) => void
507
496
 
497
+ declare type PeriodicallyOptions<T> = {
498
+ period: number
499
+ payload?: T
500
+ offset?: number
501
+ }
502
+
503
+ declare type PeriodicallyWithCustomTimerOptions<T> = {
504
+ timer: PeriodicTimerFunction
505
+ payload?: T
506
+ }
507
+
508
508
  declare interface PeriodicPublisher<T> {
509
509
  event: string
510
510
  publish: Publish<T>
@@ -536,20 +536,26 @@ declare type PropValue =
536
536
  | ReactSourceObject
537
537
  | RenderableCollection
538
538
 
539
- export declare type Publish<T> = (event: string, payload: T) => void
539
+ export declare interface Publish<T> {
540
+ (event: string, payload: T): void
541
+ }
542
+
543
+ declare interface PublishExtended<T> extends Publish<T> {
544
+ withTimeout: <T>(event: string, options: WithTimeoutOptions<T>) => Unsubscribe
545
+ periodically: <T>(
546
+ event: string,
547
+ options: PeriodicallyOptions<T>,
548
+ ) => Unsubscribe
549
+ periodicallyWithCustomTimer: <T>(
550
+ event: string,
551
+ options: PeriodicallyWithCustomTimerOptions<T>,
552
+ ) => Unsubscribe
553
+ }
540
554
 
541
555
  declare type PublishFromDom_2 = Publish<Event>
542
556
 
543
557
  declare const publishLocation: (app: App) => void
544
558
 
545
- declare const publishPeriodically: <T>(
546
- options: PublishPeriodicallyOptions<T>,
547
- ) => () => void
548
-
549
- declare type PublishPeriodicallyOptions<T> =
550
- | GeneralPeriodicPublisherOptions<T>
551
- | CustomPeriodicPublisherOptions<T>
552
-
553
559
  declare type ReactSourceObject = {
554
560
  fileName: string
555
561
  lineNumber: string
@@ -741,6 +747,8 @@ declare class StoreUpdaterList<T> {
741
747
  removeBy(matcherFunction: (value: T) => boolean): void
742
748
  includes(value: T): boolean
743
749
  appendIfUnique(item: T): void
750
+ findBy(matcherFunction: (value: T) => boolean): T
751
+ replace(original: T, replacement: T): void
744
752
  }
745
753
 
746
754
  declare class StoreUpdaterObject<T extends object> {
@@ -801,4 +809,9 @@ declare type ViewModel<ATTRIBUTES, STORE_MAP> = (
801
809
  storeMap: STORE_MAP,
802
810
  ) => Partial<ATTRIBUTES>
803
811
 
812
+ declare type WithTimeoutOptions<T> = {
813
+ timeout: number
814
+ payload?: T
815
+ }
816
+
804
817
  export {}