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

tutorial todos #859

Open
NullVoxPopuli opened this issue Apr 22, 2023 · 18 comments
Open

tutorial todos #859

NullVoxPopuli opened this issue Apr 22, 2023 · 18 comments
Labels

Comments

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Jun 29, 2023

How to do Polling with a resource:

import { resourceFactory, resource } from 'ember-resources';

class State {
  // this part I don't know, and is specific to your use case
  @tracked foo;
  @tracked bar;
}

const Status = resourceFactory((pollingInternal = 10_000) => {
  return resource(({ on }) => {
    let state = new State();
    async function getStatus() {
       // make your request here 
       state.foo = "foo";
    }

    let interval = setInterval(getStatus, pollingInterval);

    on.cleanup(() => clearInterval(interval));

    return state;
  });
});

and then in a component or something:

{{#let (Status) as |status|}}
  {{status.foo}}
{{/let}}

or in js

class {
  @use status = Status;
  
   get foo() {
    return this.status.foo;
  }
}
Wait for composition to be more widely supported in ember-resources?
const Status = resourceFactory((pollingInternal = 10_000) => {
  return resource(({ on, use }) => {
    let time = cell(0);
    let request = use(TrackedFunction(async () => {
       // ...
    }, time));

    let interval = setInterval(() => time.current++, pollingInterval);

    on.cleanup(() => clearInterval(interval));

    return () => request.current;
  });
});

but this isn't implemented yet for TrackedFunction, and I think may have some ergonomics / coherance issues when done this way -- still need to work through it.

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Jul 7, 2023

Convert to tutorial:

@NullVoxPopuli
Copy link
Owner Author

Convert to tutorial:

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Jul 23, 2023

Fancy CSS effects

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Jul 24, 2023

If you absolutely must

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Jul 24, 2023

Topics to cover

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Jul 27, 2023

Convert to tutorial:

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Oct 5, 2023

more glimmer features:

  • unbound

j/k: https://discuss.emberjs.com/t/the-status-of-unbound/11187

no one should use this

@NullVoxPopuli
Copy link
Owner Author

Integrations with bonkers libraries

@NullVoxPopuli
Copy link
Owner Author

"an" implementation for throttle here

@NullVoxPopuli
Copy link
Owner Author

casting:

@value={{String f.value}}
@value2={{Boolean f.value}}

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Jan 11, 2024

@NullVoxPopuli
Copy link
Owner Author

Custom reactive collections that are efficient on memory
demo here

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Mar 12, 2024

Passing the constantly-reactive value from a resource to a helper
demo here

and the short way:
demo here

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented Mar 17, 2024

From socials:

  • is @cached getters / Formulas / and/or techniques for only triggering a tracked value only if it actually has changed.
  • data loading section could use more examples: ember-data, ember-concurrency, and custom logic (a la trackedfunction). Especially highlighting footguns, entanglement of tracked state, etc

@NullVoxPopuli
Copy link
Owner Author

add proper <style> tutorial chapters.

hopefully one of those two libraries allows for browser-only usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant