Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Preview #954

Merged
merged 1 commit into from
Jul 20, 2023
Merged

Release Preview #954

merged 1 commit into from
Jul 20, 2023

Conversation

github-actions[bot]
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

[email protected]

Minor Changes

  • #952 1551b33 Thanks @NullVoxPopuli! - Introduce resources as modifiers.
    This brings alignment with Starbeam's plans for modifiers as a universal primitive.

    In ember-resources, using modifiers as resources looks like this:

    import { resource } from 'ember-resources';
    import { modifier } from 'ember-resources/modifier';
    
    const wiggle = modifier((element, arg1, arg2, namedArgs) => {
        return resource(({ on }) => {
            let animation = element.animate([
                { transform: `translateX(${arg1}px)` },
                { transform: `translateX(-${arg2}px)` },
            ], {
                duration: 100,
                iterations: Infinity,
            });
    
            on.cleanup(() => animation.cancel());
        });
    });
    
    <template>
        <div {{wiggle 2 5 named="hello"}}>hello</div>
    </template>

    The signature for the modifier here is different from ember-modifier, where positional args and named args are grouped together into an array and object respectively.

    This signature for ember-resource's modifier follows the plain function invocation signature.

    in Starbeam
    import { resource } from '@starbeam/universal';
    
    function wiggle(element, arg1, arg2, namedArgs) {
        return resource(({ on }) => {
            let animation = element.animate([
                { transform: `translateX(${arg1}px)` },
                { transform: `translateX(-${arg2}px)` },
            ], {
                duration: 100,
                iterations: Infinity,
            });
    
            on.cleanup(() => animation.cancel());
        });
    }
    
    <template>
        <div {{wiggle 2 5 named="hello"}}>hello</div>
    </template>

@stackblitz
Copy link

stackblitz bot commented Jul 20, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@NullVoxPopuli NullVoxPopuli merged commit 3002ec8 into main Jul 20, 2023
@NullVoxPopuli NullVoxPopuli deleted the changeset-release/main branch July 20, 2023 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant