ResourceComponent
@combeenation/custom-code-utils
Class: ResourceComponent<TResourceName>
Represents a component of type Resource
Can be used to upload data
Requires a component where "user upload" is enabled (can be enabled when creating the component)
Type Parameters
TResourceName
TResourceName extends string
Constructors
Constructor
new ResourceComponent<
TResourceName>(name):ResourceComponent<TResourceName>
Parameters
name
string
Returns
ResourceComponent<TResourceName>
Properties
name
readonlyname:string
Methods
upload()
upload(
resourceName,resource):Promise<UploadState>
Upload a single resource into a component It is executed asynchronous and provides a Promise which resolves when the resource upload has been finished and rejects if the upload has failed.
Parameters
resourceName
TResourceName
resource
ResourceData
Returns
Promise<UploadState>
upload state of the resource
Example
MyResCmp.upload('screenshot', new File([], 'myfile.txt'));
uploadMultiple()
uploadMultiple<
T>(resources):Promise<UploadStateMap<keyofT&string>>
Upload multiple resources into a component It is executed asynchronous and provides a Promise which resolves when the resource upload has been finished and rejects if the upload has failed.
Type Parameters
T
T extends ResourceMap<TResourceName>
Parameters
resources
T
Returns
Promise<UploadStateMap<keyof T & string>>
upload state of the individual resources
Example
MyResCmp.uploadMultiple({ screenshot: new File([], 'myfile.txt'));