Thanks to visit codestin.com
Credit goes to github.com

Skip to content

v2.3.0 - Streamliner

Choose a tag to compare

@felixtrz felixtrz released this 29 May 15:49
· 60 commits to main since this release

A focused release that streamlines the component API by removing lifecycle hooks in favor of a more flexible query subscription system.

Breaking Changes

  • Removed component lifecycle hooks: The onAttach and onDetach callbacks have been removed from the component API. Components are now pure data containers without built-in lifecycle management.

  • Migration required: Applications using onAttach/onDetach must migrate to query subscriptions:

    // Before
    const Component = createComponent(schema, onAttach, onDetach);
    
    // After
    const Component = createComponent(schema);
    const query = world.queryManager.registerQuery({ required: [Component] });
    query.subscribe('qualify', onAttach);
    query.subscribe('disqualify', onDetach);

Added

  • Query subscription for lifecycle tracking: Use query.subscribe('qualify'/'disqualify') to track when components are added or removed from entities
  • Multiple lifecycle listeners: The new system supports multiple subscribers for the same component events
  • Conditional lifecycle tracking: Create queries that track combinations of components, not just individual ones

Fixed

  • Fixed missing disqualify callbacks when removing the last component from an entity

Changed

  • Simplified component API - components are now pure data structures
  • Improved separation of concerns - lifecycle logic is decoupled from component definitions
  • Enhanced flexibility - subscriptions can be dynamically added or removed at runtime

Documentation

  • Updated component documentation to reflect the removal of lifecycle hooks
  • Added comprehensive examples of using query subscriptions for lifecycle tracking
  • Enhanced query documentation with component lifecycle tracking patterns