This has been in my head for a while but never written down. I should turn this issue into a Markdown document in this repo but let's just record it here for now.
Current back-pocket solution:
// async-local-storage
// "Real" exports:
export class StorageArea { ... };
export const storage = new StorageArea("default");
// Exports meant mainly for use by other LAPIs:
export const StorageArea_prototype_get = StorageArea.prototype.get;
export const StorageArea_prototype_set = StorageArea.prototype.set;
// ... etc ...
// other-lapi-that-needs-storage
import { storage, StorageArea_prototype_get } from "std:async-local-storage";
const Reflect_call = getOriginalStatic("Reflect", "call");
const result = Reflect_call(StorageArea_prototype_get, storage);
An ideal solution would be to make get-originals extensible so that authors could register "their" originals. That would avoid the split between get-originals for platform code, and ugly-manual-exports for LAPIs that want to share with each other.
That's a bit tricky with the current get-originals design, but we should keep an eye on it as get-originals evolves, since the design is nowhere near settled.
This has been in my head for a while but never written down. I should turn this issue into a Markdown document in this repo but let's just record it here for now.
Current back-pocket solution:
An ideal solution would be to make get-originals extensible so that authors could register "their" originals. That would avoid the split between get-originals for platform code, and ugly-manual-exports for LAPIs that want to share with each other.
That's a bit tricky with the current get-originals design, but we should keep an eye on it as get-originals evolves, since the design is nowhere near settled.