summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-26 15:07:11 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-26 17:18:17 -0500
commit7f9a73135da4244e779f32179c7d19e6984bbc55 (patch)
tree9ba137365174a89f7960634bbb4d1859ba0e86dd /ext/bg
parent0ebf6763051cc5e162efcca4846dd3ac7eae1e0e (diff)
Remove utilAsync
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/settings-profiles.js14
-rw-r--r--ext/bg/js/settings.js8
-rw-r--r--ext/bg/js/util.js6
3 files changed, 11 insertions, 17 deletions
diff --git a/ext/bg/js/settings-profiles.js b/ext/bg/js/settings-profiles.js
index 3ae9db14..357a1b9b 100644
--- a/ext/bg/js/settings-profiles.js
+++ b/ext/bg/js/settings-profiles.js
@@ -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) {
diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js
index ab267c32..d1f9d0d1 100644
--- a/ext/bg/js/settings.js
+++ b/ext/bg/js/settings.js
@@ -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);
}
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index a6126677..b9e602b3 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -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));
}