Skip to content

Releases: mediamonks/seng-event

v2.0.2

08 Jun 18:26
a024639
Compare
Choose a tag to compare

Dependency updates

v2.0.1

03 Jun 11:35
2d5826f
Compare
Choose a tag to compare
  • #35 Export interfaces and types

v2.0.0

26 Feb 11:16
2c8d79f
Compare
Choose a tag to compare

New features

Most new features are centered around better typings

EventDispatcher can be restricted to certain event classes

You can now pass a generic parameter to EventDispatcher indicating
which type of events it will dispatch. Besides it serving as documentation to
other developers about which events to expect, it also allows this library
to add more useful typings to methods like addEventListener. Example:

class Scheduler extends EventDispatcher<SchedulerEvent> {

It is now easier to create event classes

Event classes can still be created by manually extending AbstractEvent.
However, this is somewhat verbose. Moreover, it is very common to want to
have some kind of data property on an event. This is now possible using
2 new utilities: createEventClass and createIsomorphicEventClass. See
the readme for more info.

Event classes can have isomorphic data or options

Previously an event class was either fixed to a set of options and a certain
type of data, or it was typed too loosely. It is now possible to have the
options and the data depend on the event type.

Changes

Static string types on Event classes

Instead of the types being available directly on the class constructor,
they are now nested in a types property:

foo.addEventListener(new SomeEvent(SomeEvent.types.FOO, ...));

Private fields

A lot of private fields have been changed to protected to allow for
more extensibility

Removals

Removed CommonEvent and BasicEvent

As it is now very easy to create your own strongly typed event classes,
it no longer makes sense to export generic classes. Instead, we
should encourage the definition of classes tailored to your project.

Removed IEventDispatcher and IEvent

These interfaces contain a lot of duplication with their corresponding
classes, and were slowing down development. Typing things like so will
also remove the strong typing. The rationale behind it was that we
theoretically could have EventDispatcher interact with a custom
implementation with the same interface, but this is rarely to never done.
When wanting some kind of custom functionality, it usually suffices to
extend EventDispatcher and override the methods.

It's also worth mentioning that there was no advantage to IEvent at all,
as AbstractEvent only has public members. This makes it possible to
create a class that implements AbstractEvent.

Removed eventTypeUtils (like generateEventTypes)

Our new createEventClass utility has a better syntax

Testing

Tests are now implemented using Jest. Additional test have been added using
dtslint, allowing us to do assertions on the types in the TypeScript compiler.

Compatibility

Requires at least TypeScript 3.1, for the mapped tuple type
functionality.

v2.0.0-alpha.7

22 Feb 14:09
Compare
Choose a tag to compare
v2.0.0-alpha.7 Pre-release
Pre-release
Create new release

v2.0.0-alpha.6

22 Feb 13:57
Compare
Choose a tag to compare
v2.0.0-alpha.6 Pre-release
Pre-release
New alpha release

v2.0.0-alpha.5

22 Feb 11:02
Compare
Choose a tag to compare
v2.0.0-alpha.5 Pre-release
Pre-release
Fix build errors

Output declarations to a temporary directory, because TS will add
the declaration directory to excludes.

Make a field public because the declarations build doesn't allow
for private fields in some places.

v2.0.0-alpha.4

22 Feb 10:43
Compare
Choose a tag to compare
v2.0.0-alpha.4 Pre-release
Pre-release
Update tslint to fix TS errors on deploy

v2.0.0-alpha.3

17 Feb 19:32
Compare
Choose a tag to compare
v2.0.0-alpha.3 Pre-release
Pre-release
Simplify createIsomorphicEventType

Move eventOptions into first parameter

v2.0.0-alpha.2

17 Feb 19:17
Compare
Choose a tag to compare
v2.0.0-alpha.2 Pre-release
Pre-release
Improve syntax and tests for isomorphic events

v2.0.0-alpha.1

17 Feb 19:10
Compare
Choose a tag to compare
v2.0.0-alpha.1 Pre-release
Pre-release
Merge branch 'master' into release-2.0.0