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