Giter VIP home page Giter VIP logo

Comments (7)

jackdotink avatar jackdotink commented on August 30, 2024 1

second option sgtm

from red.

Tazmondo avatar Tazmondo commented on August 30, 2024 1

I'm thinking of exposing it as SharedEvent (which would use Call mode) and SharedSignalEvent, since Call mode makes more sense as a default to me - it matches the behaviour of the previous Events API more closely, and more often than not you won't need more than one connection.
Writing out SharedCallEvent every time seems unnecessarily wordy to me.

from red.

jackdotink avatar jackdotink commented on August 30, 2024

Is there any reason that call events cannot yield? Also apologies, but I don't remember the issues I had, I think they just failed in tests and I didn't want to bother implementing them.

from red.

Tazmondo avatar Tazmondo commented on August 30, 2024

Is there any reason that call events cannot yield? Also apologies, but I don't remember the issues I had, I think they just failed in tests and I didn't want to bother implementing them.

I haven't thoroughly read the backend yet but I assumed since they aren't spawned, a yield would also delay all the other callbacks from the same batch of events.

from red.

Tazmondo avatar Tazmondo commented on August 30, 2024

Is there any reason that call events cannot yield? Also apologies, but I don't remember the issues I had, I think they just failed in tests and I didn't want to bother implementing them.

I haven't thoroughly read the backend yet but I assumed since they aren't spawned, a yield would also delay all the other callbacks from the same batch of events.

Nevermind, re-read it and this is not true. I'll amend the issue.

from red.

Tazmondo avatar Tazmondo commented on August 30, 2024

Here's a snag:
image
image
image

Since the function can return two different types depending on what arguments are passed, the intellisense doesn't know what to display. It also doesn't add placeholder parameter names when autocompleting.
This isn't a huge deal but does worsen the DX a little bit.

Here's the type in question:

type ConstructorType =
	(<T...>(Options: SharedCallEventOptions, Validate: ValidateFunction<T...>) -> SharedCallEvent<T...>)
	& (<T...>(Options: string | SharedSignalEventOptions, Validate: ValidateFunction<T...>) -> SharedSignalEvent<T...>)

I've got three solutions in mind:

  • Leave it as it is, it's a pretty minor issue to change the API over.
  • Create two different functions, one for creating a Signal event and one for creating a Call event. Since they have different APIs I think two different functions for creating them can make sense.
  • Unify the Call and Signal event types, so they both share the same API. This does lose the distinction between them outside of their declaration though, so when reading code you'll have to go back to the event creation to check if it's a Call or a Signal event.

I'm leaning towards the 2nd option, but it is very minor so just leaving it as is would probably be fine.

from red.

Tazmondo avatar Tazmondo commented on August 30, 2024

Adding FireWithFilter from the old Event API too as FireFilteredClients

from red.

Related Issues (3)

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.