PMA.UI Documentation by Pathomation

ImageUpload

PMA.UI.Components ImageUpload

Represents a UI component that allows the uploading of single- and multi-file format slides to PMA.core servers. Provides events to handle uploading progress, as well as ready to use upload and status components.

Constructor

new ImageUpload(context, options)

Source:
Parameters:
Name Type Description
context Context
options object Configuration options
Properties
Name Type Attributes Description
serverUrl string A string indicating the PMA.core server to upload to.
uploadElement string | HTMLElement <optional>
Optional selector or HTML element where the UI for browsing and dragging files & folders will be rendered. If not provided, no UI will be rendered.
statusElement string | HTMLElement <optional>
Optional selector or HTML element where each image’s status will be displayed. This element will display a list of slides and also give the option to the user to remove slides.
notifyOnExit boolean <optional>
A boolean indicating whether or not an alert should appear on leaving page while uploading.
Fires:

Members

(static, readonly) SlideStatus :number

Source:
Properties:
Name Type Description
MissingFiles number Slide is missing files
Queued number Slide is queued for upload
Uploading number Slide is uploading
Error number Slide uploading was unsuccessful
Done number Slide uploaded successfully
NotSupported number Slide not supported
ImageUpload slide status
Type:
  • number

Methods

(async) addFiles(files, targetPath)

Source:
Parameters:
Name Type Description
files Array.<File> The array of File objects to add to upload list
targetPath string The path to upload images to
Fires:

getSlides() → {ImageUpload~Slide}

Source:
Returns the list of processed slides, or null
Returns:
Type
ImageUpload~Slide

getUploadingStatus() → {boolean}

Source:
Returns the uploading status
Returns:
Type
boolean

listen(eventName, callback)

Source:
Attaches an event listener
Parameters:
Name Type Description
eventName PMA.UI.Components.Events The name of the event to listen to
callback function The function to call when the event occurs

removeSlide(index)

Source:
Removes a slide from the list
Parameters:
Name Type Description
index Number The index of the slide to remove
Fires:

setUploadingStatus(enable)

Source:
Pauses or resumes uploading.
Parameters:
Name Type Description
enable boolean Resumes uploading if true, else pauses uploading
Fires:

Type Definitions

Slide

Source:
Properties:
Name Type Description
id string Upload id
files Array.<File> Files contained in slide
status ImageUpload.SlideStatus Current slide uploadsing status
error string Errors returned from slide checking
targetPath string Virtual path slide will be uploaded to
relativePath string Relative path of slide in local filesystem
size number Total size of slide
uploadProgress number Upload progress