sdk: rename some methods

This commit is contained in:
mappu 2017-10-08 15:16:38 +13:00
parent f31b976c83
commit 257a0352db

View File

@ -17,24 +17,22 @@ var contented = (function ($, currentScriptPath) {
};
/**
* contented_SupportsDrop returns whether drag-and-drop is supported by this
* browser.
* supportsDrop returns whether drag-and-drop is supported by this browser.
*
* @return bool
*/
var contented_SupportsDrop = function () {
var supportsDrop = function () {
return ('ondrop' in window && 'FormData' in window && 'FileReader' in window);
}
/**
* contented_EnableDrop enables drag-and-drop upload on a DOM element.
* The class "is-dragover" will be toggled on the target element.
* initArea shows the contented upload widget over the top of a target DOM element.
*
* @param any element Drop target (string selector / DOMElement / jQuery)
* @param Function onUploaded Called with a property object for every uploaded file
* @param Function onClose Called when the widget should be destroyed
* @param Function onUploaded Called with an array of upload IDs
* @param Function onClose Called when the widget is being destroyed
*/
var contented_EnableDrop = function (elementSelector, onUploaded, onClose) {
var initArea = function (elementSelector, onUploaded, onClose) {
onUploaded = onUploaded || function () { };
onClose = onClose || function () { };
@ -79,7 +77,7 @@ var contented = (function ($, currentScriptPath) {
setType($(this).attr('data-upload-type'));
});
if (!contented_SupportsDrop()) {
if (!supportsDrop()) {
// switch default
setType('file');
}
@ -190,8 +188,8 @@ var contented = (function ($, currentScriptPath) {
//
return {
'supportsDrop': contented_SupportsDrop,
'init': contented_EnableDrop
'supportsDrop': supportsDrop,
'init': initArea
};
})(