Skip to content

Refactor event/pending event, and add a way to immediately commit an event#27

Merged
inxilpro merged 15 commits intomainfrom
feature/call-static
Dec 8, 2023
Merged

Refactor event/pending event, and add a way to immediately commit an event#27
inxilpro merged 15 commits intomainfrom
feature/call-static

Conversation

@inxilpro
Copy link
Copy Markdown
Contributor

We did this on the last livestream. It moves the fire and make methods to mostly just defer to the PendingEvent implementation. It also introduces a new fireNow() method that allows for firing an event and immediately receiving the result of that event's handle() method. This should ease the "how to handle a 'create'-type request, where you want to use the model immediately" question.

I'm leaving as draft because I'm not 100% sure about the recursive WeakMap portion. Mulling it over…

@inxilpro inxilpro marked this pull request as ready for review December 7, 2023 17:53
@inxilpro
Copy link
Copy Markdown
Contributor Author

inxilpro commented Dec 7, 2023

OK, I feel much happier with things now that the results are handled elsewhere. I'm pretty sure that the metadata handler can also be used to work on #14 — I'm going to pair with @skylerkatz later today on that, hopefully!

@inxilpro inxilpro changed the title Move event methods to __callStatic Refactor how events interact with pending events, and add a fireNow method Dec 7, 2023
@skylerkatz
Copy link
Copy Markdown
Collaborator

This looks much cleaner than the initial rounds.

Now you just need to update the verb() function to take a second now boolean, or a second function verb_now() that calls fireNow()

@inxilpro inxilpro changed the title Refactor how events interact with pending events, and add a fireNow method Refactor event/pending event, and add a way to immediately commit an event Dec 7, 2023
Replaced the 'fireAndCommit' method name with 'commit' across multiple files for better readability and simplicity. This change is reflected in the 'Event', 'Support/helpers' and 'Support/PendingEvent' files, along with relevant modifications in associated tests..
@inxilpro inxilpro merged commit 17c8b1a into main Dec 8, 2023
@inxilpro inxilpro deleted the feature/call-static branch December 8, 2023 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants