Closed ffMathy closed 1 year ago
cc @m4ss1m0g (in case you don't get notifications for this kind of stuff).
@ffMathy You have done great work! Can you also update the CHANGELOG with these new improvements?
Close the #5
Thanks for merging! However, I realized I forgot to follow the "keep a changelog" format, so I actually made an additional commit after. See #10 now.
Sorry about that!
@ffMathy. No problem. However, you must increment 1 the patch level of packages.json, 1.0.1 otherwise I can't publish the package
I think it's actually okay to not publish the package, as only CHANGELOG.md has changed, which is not actually part of the package. Do you agree?
In this case, the PR remains open, otherwise, if I merge it tries to publish and returns an error.
I think is better to merge.
Awesome stuff ❤️ thanks once again.
More improvements will come, but I don't know when.
For instance, I'd like to throw an exception if the settings get mutated after they've been used once.
That way, we can tell the user if they are mutating settings after load.
I want to use this package in my work (I work for a corporation). However, for that to happen, I think these things that I propose here should be fixed. Alternatively I think I will make a fork at some point.
It's a big one. I hope it's okay, and that you can find the time for looking into it 🙏
Documentation
Notification handlers
DispatcherInstance
class. Instead, we now have mapping classes (similar, but not entirely identical). See the rest of the notes.Dispatcher
has a property callednotifications
from where the notifications mappings are controlled (and execution order).INotificationClass
andINotificationHandlerClass
. These are used for classes instead of instances of these types. The code wrongly hadINotification
specified in cases where the actual real type wasINotificationClass
. This also strengthens the code and makes it harder to write it wrong.publish
method on theMediator
now returns aPromise<void>
instead ofPromise<void[]>
.Dispatcher
Dispatcher
now just has two properties.notifications
andbehaviors
, which control the handler mappings for each of them, and the order.Pipeline behaviors
Dispatcher
has a property calledbehaviors
from where the pipeline behavior mappings are controlled (and execution order).IPipelineBehavior
interface, as well as aIPipelineBehaviorClass
type has been introduced.Boyscouting
"importsNotUsedAsValues": "error"
to thetsconfig.json
file, so that the TypeScript compiler will give an error if a regular import is used where a type import could have been used instead. Again, to decrease the chance of accidental circular dependencies."strict": true
to thetsconfig.json
file, so that we now have full TypeScript strictness in the project.Miscellaneous