Skip to content
This repository was archived by the owner on Aug 17, 2023. It is now read-only.
This repository was archived by the owner on Aug 17, 2023. It is now read-only.

introduce services based on pub/sub for actions executed by widget  #9

@ethernian

Description

@ethernian

Currently, widgets exec handlers do not follow any specific pattern while calling external services like openOverlay or sendTransaction. Now they should follow a common generic pattern.

sketching Example :

class SomeFeature implements IFeature {
   @Load('likesService.public.name') 
   private likesService;
   ...
    button({ // `this` is bound to the button instance
        label: likesService.send(this)
              .on(()=>this.state=WAITING)  //null filter may stay for subscription status events
              .on('likeChanged', likeNr => this.label=likeNr)
        ...
        });
   ...
}

Common Schema

<ServiceRef>.<makeSubscriptionFn>(...)      //creates subscription for this instance
     .on(SubFilterExpr1, cbEventHandler1)       //chain of event handlers
     .on(SubFilterExpr2, cbEventHandler2)

DesignChoices:

  • better name for Services
  • Is the makeSubscriptionFn the same for all services? Like .send(...) or subscribe(...)
    Maybe service is a function and the fn call will create subscribtion like openOverlay('ConnectedAction')
  • create curryied subsurvices like
  • is it possible to use this service pattern for all action calls made by widgets?
    someService.onError = (errorHandler) => someService.on('error',errorHandler)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions