Remove utilAsync

This commit is contained in:
toasted-nutbread 2019-11-26 15:07:11 -05:00
parent 0ebf676305
commit 7f9a73135d
4 changed files with 11 additions and 23 deletions

View File

@ -35,16 +35,16 @@ async function profileOptionsSetup() {
}
function profileOptionsSetupEventListeners() {
$('#profile-target').change(utilAsync(onTargetProfileChanged));
$('#profile-target').change((e) => onTargetProfileChanged(e));
$('#profile-name').change(onProfileNameChanged);
$('#profile-add').click(utilAsync(onProfileAdd));
$('#profile-remove').click(utilAsync(onProfileRemove));
$('#profile-remove-confirm').click(utilAsync(onProfileRemoveConfirm));
$('#profile-copy').click(utilAsync(onProfileCopy));
$('#profile-copy-confirm').click(utilAsync(onProfileCopyConfirm));
$('#profile-add').click((e) => onProfileAdd(e));
$('#profile-remove').click((e) => onProfileRemove(e));
$('#profile-remove-confirm').click((e) => onProfileRemoveConfirm(e));
$('#profile-copy').click((e) => onProfileCopy(e));
$('#profile-copy-confirm').click((e) => onProfileCopyConfirm(e));
$('#profile-move-up').click(() => onProfileMove(-1));
$('#profile-move-down').click(() => onProfileMove(1));
$('.profile-form').find('input, select, textarea').not('.profile-form-manual').change(utilAsync(onProfileOptionsChanged));
$('.profile-form').find('input, select, textarea').not('.profile-form-manual').change((e) => onProfileOptionsChanged(e));
}
function tryGetIntegerValue(selector, min, max) {

View File

@ -155,8 +155,8 @@ async function formWrite(options) {
}
function formSetupEventListeners() {
$('input, select, textarea').not('.anki-model').not('.ignore-form-changes *').change(utilAsync(onFormOptionsChanged));
$('.anki-model').change(utilAsync(onAnkiModelChanged));
$('input, select, textarea').not('.anki-model').not('.ignore-form-changes *').change((e) => onFormOptionsChanged(e));
$('.anki-model').change((e) => onAnkiModelChanged(e));
}
function formUpdateVisibility(options) {
@ -219,7 +219,7 @@ async function onReady() {
chrome.runtime.onMessage.addListener(onMessage);
}
$(document).ready(utilAsync(onReady));
$(document).ready(() => onReady());
/*
@ -582,7 +582,7 @@ async function ankiFieldsPopulate(element, options) {
container.append($(html));
}
tab.find('.anki-field-value').change(utilAsync(onFormOptionsChanged));
tab.find('.anki-field-value').change((e) => onFormOptionsChanged(e));
tab.find('.marker-link').click(onAnkiMarkerClicked);
}

View File

@ -16,12 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function utilAsync(func) {
return function(...args) {
func.apply(this, args);
};
}
function utilIsolate(data) {
return JSON.parse(JSON.stringify(data));
}

View File

@ -17,12 +17,6 @@
*/
function utilAsync(func) {
return function(...args) {
func.apply(this, args);
};
}
function utilInvoke(action, params={}) {
const data = {action, params};
return new Promise((resolve, reject) => {