Skip to content

Instantly share code, notes, and snippets.

@chriskrycho
chriskrycho / load.js
Last active October 10, 2023 10:47
An auto-tracked AsyncData and load helper (with no proxies!)
import { tracked } from '@glimmer/tracking';
import { helper } from '@ember/component/helper';
import { action } from '@ember/object';
/**
* @template T
* @type {WeakMap<Promise<T>, AsyncData<T, any>>}
*/
const PROMISE_STATE = new WeakMap();