本文整理汇总了TypeScript中farmbot-toastr.success函数的典型用法代码示例。如果您正苦于以下问题:TypeScript success函数的具体用法?TypeScript success怎么用?TypeScript success使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了success函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
return function (dispatch, getState) {
const resources = getState().resources;
const { weeks, dailyOffsetMs, selectedSequenceUUID, currentRegimen } =
resources.consumers.regimens;
// If the user hasn't clicked a regimen, initialize one for them.
if (currentRegimen) {
// Proceed only if they selected a sequence from the drop down.
if (selectedSequenceUUID) {
const sequence =
findSequence(resources.index, selectedSequenceUUID).body;
const groupedItems = weeks.length > 0 ?
groupRegimenItemsByWeek(weeks, dailyOffsetMs, sequence) : undefined;
// Proceed only if days are selected in the scheduler.
if (groupedItems && groupedItems.length > 0) {
const regimen = findRegimen(resources.index, currentRegimen);
const clonedRegimen = defensiveClone(regimen).body;
clonedRegimen.regimen_items = clonedRegimen.regimen_items.concat(groupedItems);
const varData = resources.index.sequenceMetas[selectedSequenceUUID];
clonedRegimen.body = mergeDeclarations(varData, regimen.body.body);
console.log(JSON.stringify(clonedRegimen.body, undefined, 2));
dispatch(overwrite(regimen, clonedRegimen));
success(t("Item(s) added."));
} else {
return error(t("No day(s) selected."));
}
} else {
return error(t("Select a sequence from the dropdown first."), t("Error"));
}
} else {
return error(t("Select a regimen first or create one."));
}
};
示例2: logout
export function logout() {
// When logging out, we pop up a toast message to confirm logout.
// Sometimes, LOGOUT is dispatched when the user is already logged out.
// In those cases, seeing a logout message may confuse the user.
// To circumvent this, we must check if the user had a token.
// If there was infact a token, we can safely show the message.
if (Session.get()) { success("You have been logged out."); }
Session.clear(true);
// Technically this is unreachable code:
return {
type: "LOGOUT",
payload: {}
};
}
示例3: showLogOnScreen
export function showLogOnScreen(log: Log) {
switch (log.type) {
case "success":
return success(log.message, t(TITLE));
case "warn":
return warning(log.message, t(TITLE));
case "busy":
case "error":
return error(log.message, t(TITLE));
case "fun":
case "info":
default:
return info(log.message, t(TITLE));
}
}
示例4: showLogOnScreen
export function showLogOnScreen(log: Log) {
switch (log.type) {
case MessageType.success:
return success(log.message, t(TITLE));
case MessageType.warn:
return warning(log.message, t(TITLE));
case MessageType.busy:
case MessageType.error:
return error(log.message, t(TITLE));
case MessageType.fun:
case MessageType.info:
default:
return info(log.message, t(TITLE));
}
}
示例5: maybeShowLog
function maybeShowLog(log: Log) {
let chanList = _.get(log, CHANNELS, ["ERROR FETCHING CHANNELS"]);
let t = log.meta.type as ALLOWED_MESSAGE_TYPES;
const TITLE = "New message from bot";
if (chanList.includes(TOAST)) {
switch (t) {
case "success":
return success(log.message, TITLE);
case "busy":
case "warn":
case "error":
return error(log.message, TITLE);
case "fun":
case "info":
default:
return info(log.message, TITLE);
}
}
}
示例6: success
let commandOK = (noun = "Command") => () => {
let msg = noun + " request sent to device.";
success(msg, t("Request sent"));
};
示例7: jsonDownload
const ok = (resp: Response) => {
const { data } = resp;
return data ? jsonDownload(data) : success(t(Content.EXPORT_SENT));
};
示例8: t
export const commandOK = (noun = "Command") => () => {
const msg = t(noun) + t(" request sent to device.");
success(msg, t("Request sent"));
};
示例9: success
.then(() => success(t("Garden Saved.")));