Angular: Resource APIファミリーの体系図
DRANK

この記事では、Angular v22で安定版となったResource APIファミリーについて、その関係を概観する。Resource APIファミリーv22時点で Resource API に含まれる主要な公開APIは次のものである。Resource<T> インターフェースWritableResource<T> インターフェースResourceSnapshot<T> インターフェースresourceFromSnapshots 関数resource 関数httpResource 関数これらのAPIをひとつずつ解説しながら、APIファミリー内での位置づけを確認していこう。Resource<T> インターフェースこのインターフェースはAPIファミリーの中心にある。Resource APIファミリーは大きく分けて、Resourceオブジェクトを表すAPI群と、Resourceオブジェクトを作成するためのファクトリーAPI群とに分けられる。Resource<T> インターフェースはResourceオブジェクトすべてに共通する基底型であり、ファクトリーAPIの戻り値になる型でもある。export interface Resource<T> { readonly value: Signal<T>; readonly status: Signal<ResourceStatus>; readonly error: Signal<Error undefined>; readonly isLoading: Signal<boolean>; readonly snapshot: Signal<ResourceSnapshot<T>>; has…

blog.lacolaco.net
Related Topics: API Economy Angular
1 comments