ECSpanse - an Entity Component System framework for Elixir

New release v0.8.0

Refactors projections. There are breaking changes. Please see the changelog.

The main change is about introducing the Ecspanse.Projection struct

  @type t :: %Ecspanse.Projection{
          state: projection_state(),
          result: projection_result(),
          loading?: boolean(),
          ok?: boolean(),
          error?: boolean(),
          halted?: boolean()
        }

  defstruct state: :loading,
            result: nil,
            loading?: true,
            ok?: false,
            error?: false,
            halted?: false

This is somehow inspired by the Phoenix Liveview AsyncResult struct.

The struct is wrapping the implemented projections structs and manages their state.

During last week I found myself embedding state fields in the projections structs, so I can then decide, in the client, if the projection is ready to be used or not.

This can now be achieved with code like:

<div :if={@enemy_projection.loading?}><.spinner /></div>
<div :if={@enemy_projection.ok?}>
  <.enemy enemy={@enemy_projection.result} />
</div>