jaxs 0.9.3 → 0.9.5

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
@@ -6,7 +6,7 @@ import { Subscribe as Subscribe_2 } from '.'
6
6
  export declare class App {
7
7
  window: Window
8
8
  document: Document
9
- publish: Publish<any>
9
+ publish: PublishExtended<any>
10
10
  subscribe: Subscribe
11
11
  bus: JaxsBus
12
12
  state: State
@@ -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>,
@@ -184,7 +184,7 @@ declare const createBus: () => {
184
184
 
185
185
  declare const createRouteState: (state: State) => void
186
186
 
187
- declare const createState: (publisher: Publish<any>) => State
187
+ declare const createState: (publisher: PublishExtended<any>) => State
188
188
 
189
189
  declare type CustomPeriodicOptions = {
190
190
  timer: PeriodicTimerFunction
@@ -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,
@@ -440,7 +433,7 @@ declare type ListenerKit<T> = {
440
433
  state: State_2
441
434
  document: Document
442
435
  window: Window
443
- publish: Publish<any>
436
+ publish: PublishExtended<any>
444
437
  eventName: string
445
438
  payload: T
446
439
  }
@@ -467,13 +460,7 @@ export declare const ListStore: {
467
460
  declare const locationChangeEvent = 'navigation:location-change'
468
461
 
469
462
  export declare namespace messageBus {
470
- export {
471
- createBus,
472
- JaxsBus,
473
- ExactSubscriptions,
474
- FuzzySubscriptions,
475
- publishPeriodically,
476
- }
463
+ export { createBus, JaxsBus, ExactSubscriptions, FuzzySubscriptions }
477
464
  }
478
465
 
479
466
  declare const navigate: ({
@@ -507,6 +494,17 @@ declare const onLinkClick: (listenerKit: ListenerKit<MouseEvent>) => void
507
494
 
508
495
  declare const onLocationChange: (listenerKit: ListenerKit<null>) => void
509
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
+
510
508
  declare interface PeriodicPublisher<T> {
511
509
  event: string
512
510
  publish: Publish<T>
@@ -538,19 +536,25 @@ declare type PropValue =
538
536
  | ReactSourceObject
539
537
  | RenderableCollection
540
538
 
541
- export declare type Publish<T> = (event: string, payload: T) => void
542
-
543
- declare type PublishFromDom_2 = Publish<Event>
539
+ export declare interface Publish<T> {
540
+ (event: string, payload: T): void
541
+ }
544
542
 
545
- declare const publishLocation: (app: App) => void
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
+ }
546
554
 
547
- declare const publishPeriodically: <T>(
548
- options: PublishPeriodicallyOptions<T>,
549
- ) => () => void
555
+ declare type PublishFromDom_2 = PublishExtended<Event>
550
556
 
551
- declare type PublishPeriodicallyOptions<T> =
552
- | GeneralPeriodicPublisherOptions<T>
553
- | CustomPeriodicPublisherOptions<T>
557
+ declare const publishLocation: (app: App) => void
554
558
 
555
559
  declare type ReactSourceObject = {
556
560
  fileName: string
@@ -652,12 +656,12 @@ declare namespace start {
652
656
  declare const startNavigation: (app: App) => void
653
657
 
654
658
  export declare class State {
655
- publisher: Publish<any>
659
+ publisher: PublishExtended<any>
656
660
  stores: StoresCollection
657
661
  eventNamePrefix: string
658
662
  notifications: Set<string>
659
663
  inTransaction: boolean
660
- constructor(publisher: Publish<any>)
664
+ constructor(publisher: PublishExtended<any>)
661
665
  create<T>(name: string, initialState: T): Store<T>
662
666
  store<T>(name: string): Store<T>
663
667
  get<T>(name: string): T
@@ -805,4 +809,9 @@ declare type ViewModel<ATTRIBUTES, STORE_MAP> = (
805
809
  storeMap: STORE_MAP,
806
810
  ) => Partial<ATTRIBUTES>
807
811
 
812
+ declare type WithTimeoutOptions<T> = {
813
+ timeout: number
814
+ payload?: T
815
+ }
816
+
808
817
  export {}