GithubHelp home page GithubHelp logo

Ngxs Service Rename about store HOT 14 CLOSED

ngxs avatar ngxs commented on July 17, 2024
Ngxs Service Rename

from store.

Comments (14)

abalad avatar abalad commented on July 17, 2024 1
constructor(private commander: Commander) {
   this.commander.dispatch(...);
}

from store.

abalad avatar abalad commented on July 17, 2024 1
constructor(private dspatcher: Dispatcher) {
   this.dspatcher.dispatch(...);
}

from store.

st-clair-clarke avatar st-clair-clarke commented on July 17, 2024

Change @Store to @ngxs or @NgxsStore; then Store would be now available for use.
Albeit it would be a breaking change.

NB. Be mindful though that ngrx/store uses Store too:

constructor(private store: Store){
this.counter = store.select('counter');
}

Not that it is a major issue but some folks might not like the name clash in 2 major offerings.

Cheers

from store.

BeastCode avatar BeastCode commented on July 17, 2024

How about:

constructor(private state: State) {
this.state.dispatch(...);
}

from store.

st-clair-clarke avatar st-clair-clarke commented on July 17, 2024

My only issue with that is this:

A general statement for accessing state is shown below

  @Select( state => state.clerking.ui.history.ros.rs.cough )
  protected coughUi$: Observable<IFormState>

Now we have a double state

  @Select( state =>state. state.clerking.ui.history.ros.rs.cough )
  protected coughUi$: Observable<IFormState>

Apart from that I don't see any great issue.

Maybe we could do this:

  @Select( appState =>appState. state.clerking.ui.history.ros.rs.cough )
  protected coughUi$: Observable<IFormState>

Cheers

from store.

amcdnl avatar amcdnl commented on July 17, 2024

@BeastCode - I thought about State when i started this. After typing it a few times, I didn't quite like it, I don't really like this either tho. I thought about RootStore though.

from store.

amcdnl avatar amcdnl commented on July 17, 2024

What about Gateway?

from store.

BeastCode avatar BeastCode commented on July 17, 2024

Gateway - An object that encapsulates access to an external system or resource :)

I was trying to find a synonym for store that would fit, the only thing I found was: Vault

from store.

amcdnl avatar amcdnl commented on July 17, 2024

I got Gateway from this - > https://docs.axonframework.org/v/3.1/part3/command-dispatching.html

Could also think about Dispatcher Commander?

from store.

abalad avatar abalad commented on July 17, 2024
constructor(private store: StoreService) {
   this.store.dispatch(...);
}

from store.

abalad avatar abalad commented on July 17, 2024
constructor(private gateway: Gateway) {
   this.gateway.dispatch(...);
}

from store.

abalad avatar abalad commented on July 17, 2024
constructor(private state: State) {
    this.state.dispatch(...);
}

from store.

amcdnl avatar amcdnl commented on July 17, 2024

Proposal:

export interface ZooStateModel {}

@State<ZooStateModel>({
  defaults: {}
})
export class ZooState {
  @Action(Feed)
  feed() {...}
}

export class ZooComponent {
  constructor(private store: Store<T>) {}

  foo() {
    this.store.dispatch(new Feed());
  }
}

from store.

amcdnl avatar amcdnl commented on July 17, 2024

Done in next branch.

from store.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.