Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

[FEAT] Modifier Managers #245

Merged
merged 1 commit into from
Mar 27, 2020
Merged

[FEAT] Modifier Managers #245

merged 1 commit into from
Mar 27, 2020

Commits on Mar 27, 2020

  1. [FEAT] Modifier Managers

    Adds modifier managers that match Ember's modifier manager API. They can
    be defined by importing `setModifierManager` from `@glimmer/core`:
    
    ```ts
    import {
      modifierCapabilities,
      setModifierManager,
    } from '@glimmer/core';
    ```
    
    Also allows users to use simple functions as modifiers:
    
    ```js
    function scroll(element, position) {
      element.scrollY = position;
    
      return () => element.scrollY = 0;
    }
    ```
    
    The function receives the element as the first argument, and any
    positional arguments after that. It can return a destructor, which will
    be called whenever the modifier is destroyed, or before it is updated
    and the modifier is run again.
    
    Also adds a `TrackedObject` implementation for tests, which makes life
    for testing a bit easier.
    Chris Garrett committed Mar 27, 2020
    Configuration menu
    Copy the full SHA
    44e0323 View commit details
    Browse the repository at this point in the history