all called functions can have functions options setable during init

function_options is a new object that will be passed on as the last
parameter on all functions
This commit is contained in:
2022-11-30 09:59:24 +09:00
parent d804a81021
commit 22baff8b13
2 changed files with 27 additions and 14 deletions

View File

@@ -96,12 +96,14 @@ function ajaxWrapper(call_id, queryString = {}, control = {}, url = 'backend.php
/**
* FILE CHANGE:
* helper call for ajax file upload on file selected
* @param {Number} file_pos Position in upload queue
* @param {String} target_file The file upload target prefix id
* @param {String} target_file The file upload target prefix id
* @param {Number} file_pos Position in upload queue
* @param {String} target_router [description]
* @param {Object} options additional functions options
*/
function fileChangeFunction(target_file, file_pos, target_router)
function fileChangeFunction(target_file, file_pos, target_router, options={})
{
console.log('{FILE} CHANGE [%s/%s] FUNCTION CALL [%s]', target_file, file_pos, target_router);
console.log('{FILE} CHANGE [%s/%s] FUNCTION CALL [%s]: [%o]', target_file, file_pos, target_router, options);
clearAlerts();
// console.log('Upload Status: %s', $('#' + target_file + '-upload-status').outerHeight());
}
@@ -328,6 +330,7 @@ $(document).ready(function () {
target_action: '',
form_parameters: {'parameter_a': 'Value 123'},
auto_submit: false,
function_options: {action_box_id: 'actionBox-alt', 'other': 'free'},
fileChange: fileChangeFunction,
fileChangeAll: fileChangeFunctionAll,
fileRemove: fileRemoveFunction,