mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 18:13:25 +00:00
add docs
This commit is contained in:
34
.docs/content/2.Api/0.makeProviders.md
Normal file
34
.docs/content/2.Api/0.makeProviders.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# `makeProviders`
|
||||
|
||||
Make an instance of providers with configuration.
|
||||
This is the main entrypoint of the library. It is recommended to make one instance globally and reuse it throughout your application.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import { targets, makeProviders, makeDefaultFetcher } from "@movie-web/providers";
|
||||
|
||||
const providers = makeProviders({
|
||||
fetcher: makeDefaultFetcher(fetch),
|
||||
target: targets.NATIVE, // target native app streams
|
||||
});
|
||||
```
|
||||
|
||||
## Type
|
||||
|
||||
```ts
|
||||
function makeProviders(ops: ProviderBuilderOptions): ProviderControls;
|
||||
|
||||
interface ProviderBuilderOptions {
|
||||
// instance of a fetcher, all webrequests are made with the fetcher.
|
||||
fetcher: Fetcher;
|
||||
|
||||
// instance of a fetcher, in case the request has cors restrictions.
|
||||
// this fetcher will be called instead of normal fetcher.
|
||||
// if your environment doesnt have cors restrictions (like nodejs), there is no need to set this.
|
||||
proxiedFetcher?: Fetcher;
|
||||
|
||||
// target to get streams for
|
||||
target: Targets;
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user