Skip to content

Commit cf2f974

Browse files
authored
feat: provider to configure (#435)
* feat: provider to configure * chore: update jsdoc
1 parent e2ace3a commit cf2f974

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/uploadx/lib/uploadx.provider.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Provider } from '@angular/core';
2+
import { UPLOADX_OPTIONS, UploadxOptions } from './options';
3+
4+
/**
5+
* Provides configuration options for standalone app.
6+
*
7+
* @example
8+
* ```ts
9+
* bootstrapApplication(AppComponent, {
10+
* providers: [
11+
* provideUploadx({
12+
* endpoint: uploadUrl,
13+
* allowedTypes: 'video/*,audio/*',
14+
* maxChunkSize: 96 * 1024 * 1024
15+
* })
16+
* ]
17+
* });
18+
* ```
19+
*/
20+
export function provideUploadx(options: UploadxOptions = {}) {
21+
const providers: Provider[] = [
22+
{
23+
provide: UPLOADX_OPTIONS,
24+
useValue: options
25+
}
26+
];
27+
return providers;
28+
}

src/uploadx/public-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ export * from './lib/uploaderx';
1212
export * from './lib/uploadx-drop.directive';
1313
export * from './lib/uploadx.directive';
1414
export * from './lib/uploadx.module';
15+
export * from './lib/uploadx.provider';
1516
export * from './lib/uploadx.service';
1617
export * from './lib/utils';

0 commit comments

Comments
 (0)