new ServerInteraction()
Responsible for AJAX requests, transparently handles encryption…
- Source:
Members
(private, static, readonly) ajaxHeaders :Object
ajaxHeaders to send in AJAX requests
Type:
- Object
- Source:
(static, readonly) error :Object
public variable ('constant') for errors to prevent magic numbers
Type:
- Object
- Source:
Methods
(private, static) fail(status, result)
called after a upload failure
Parameters:
Name | Type | Description |
---|---|---|
status |
int | internal code |
result |
int | original error code |
- Source:
(static) getData()
return currently set data, used in unit testing
- Source:
(static) parseUploadError(status, data, doThisThing) → {array}
Helper, which parses shows a general error message based on the result of the ServerInteraction
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:
(async, static) setCipherMessage(cipherMessage)
encrypts and sets the data
Parameters:
Name | Type | Description |
---|---|---|
cipherMessage |
object |
- Source:
(static) setCryptValues(newPassword, newKey)
sets the password to use (first value) and optionally also the
encryption key (not recommended, 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) 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(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:
(private, static) success(status, result)
called after successful upload
Parameters:
Name | Type | Description |
---|---|---|
status |
int | |
result |
int | optional |
- Source: