ensure success
is a boolean
This commit is contained in:
parent
1c41f4ea6d
commit
e76b741a5e
@ -30,9 +30,13 @@ let disruption = "";
|
||||
* @param {function} noExistCallback
|
||||
*/
|
||||
const ensureSettingsProp = (prop, existCallback, noExistCallback) => {
|
||||
settings.get(prop).then(foundKeys => {
|
||||
return settings.get(prop).then(foundKeys => {
|
||||
console.debug("storage returned", foundKeys);
|
||||
return (prop in foundKeys ? existCallback(foundKeys[prop]) : noExistCallback());
|
||||
if (prop in foundKeys){
|
||||
return existCallback(foundKeys[prop]);
|
||||
} else {
|
||||
return noExistCallback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -64,13 +68,16 @@ const bankDetailConfigKeys = ["pymt__iban", "pymt__bic"];
|
||||
function processSingleAddedNode(n) {
|
||||
if (currentStage.match(n)) {
|
||||
console.info(currentStage.name, "matched: ", n);
|
||||
const success = currentStage.execute(n)
|
||||
if (success) {
|
||||
const success = currentStage.execute(n);
|
||||
Promise.resolve(success).then((result => {
|
||||
if (result === true) {
|
||||
console.info(currentStage.name, "executed successfully");
|
||||
} else {
|
||||
console.error(currentStage.name, "failed");
|
||||
}
|
||||
nextStage();
|
||||
}));
|
||||
|
||||
} else {
|
||||
console.debug(currentStage.name, "did not match: ", n);
|
||||
}
|
||||
@ -103,7 +110,7 @@ function processMutations(mutationList, observer) {
|
||||
if (currentStage.expects == 'mutation') {
|
||||
if (currentStage.match(mutation)) {
|
||||
console.info(currentStage.name, "matched: ", mutation);
|
||||
success = currentStage.execute(mutation);
|
||||
let success = currentStage.execute(mutation);
|
||||
if (success){
|
||||
console.info(currentStage.name, "executed successfully");
|
||||
} else {
|
||||
@ -349,14 +356,15 @@ const jumpToTimeInput = {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/** @type Stage */
|
||||
const activateAppellationDropdown = {
|
||||
name: "activateAppellationDropdown",
|
||||
match: node => node.classList.contains("persoenlicheangaben") && hasConfiguredPersonalData,
|
||||
execute: node => {
|
||||
return ensureSettingsProp("addr__appellation", () => {
|
||||
const selectList = node.querySelector('.test-name-anrede.db-web-select');
|
||||
selectList.querySelector('button').dispatchEvent(_clickEv());
|
||||
const button = node.querySelector('.test-name-anrede.db-web-select button');
|
||||
button.dispatchEvent(_clickEv());
|
||||
return true;
|
||||
}, () => true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user