Class: Uploader

Uploader()

new Uploader()

Responsible for AJAX requests, transparently handles encryption…
Source:

Members

(static, readonly) error :Object

public variable ('constant') for errors to prevent magic numbers
Type:
  • Object
Source:

Methods

(static) init()

init Uploader
Source:

(static) parseUploadError(status, data, doThisThing) → {array}

Helper, which parses shows a general error message based on the result of the Uploader
Parameters:
Name Type Description
status int
data object
doThisThing string a human description of the action, which was tried
Source:
Returns:
Type
array

(static) prepare() → {object}

prepares a new upload Call this when doing a new upload to reset any data from potential previous uploads. Must be called before any other method of this module.
Source:
Returns:
Type
object

(static) run()

actually uploads the data
Source:

(static) setCryptValues(newPassword, newKey)

sets the password to use (first value) and optionally also the encryption key (not recommend, it is automatically generated). Note: Call this after prepare() as prepare() resets these values.
Parameters:
Name Type Description
newPassword string
newKey string optional
Source:

(static) setData(index, element)

encrypts and sets the data
Parameters:
Name Type Description
index string
element mixed
Source:

(static) setFailure(func)

set failure function
Parameters:
Name Type Description
func function
Source:

(static) setSuccess(func)

set success function
Parameters:
Name Type Description
func function
Source:

(static) setUnencryptedData(newData)

set the additional metadata to send unencrypted passed at once
Parameters:
Name Type Description
newData object
Source:

(static) setUnencryptedData(index, element)

set the additional metadata to send unencrypted
Parameters:
Name Type Description
index string
element mixed
Source:

(static) setUrl(newUrl)

set success function
Parameters:
Name Type Description
newUrl function
Source: