当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript farmbot-toastr.success函数代码示例

本文整理汇总了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."));
    }
  };
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:33,代码来源:actions.ts

示例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: {}
  };
}
开发者ID:MrChristofferson,项目名称:Farmbot-Web-API,代码行数:14,代码来源:actions.ts

示例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));
  }
}
开发者ID:RickCarlino,项目名称:farmbot-web-app,代码行数:15,代码来源:connect_device.ts

示例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));
  }
}
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:15,代码来源:connect_device.ts

示例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);
    }
  }
}
开发者ID:creimers,项目名称:Farmbot-Web-API,代码行数:19,代码来源:actions.ts

示例6: success

let commandOK = (noun = "Command") => () => {
  let msg = noun + " request sent to device.";
  success(msg, t("Request sent"));
};
开发者ID:creimers,项目名称:Farmbot-Web-API,代码行数:4,代码来源:actions.ts

示例7: jsonDownload

const ok = (resp: Response) => {
  const { data } = resp;
  return data ? jsonDownload(data) : success(t(Content.EXPORT_SENT));
};
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:4,代码来源:request_account_export.ts

示例8: t

export const commandOK = (noun = "Command") => () => {
  const msg = t(noun) + t(" request sent to device.");
  success(msg, t("Request sent"));
};
开发者ID:RickCarlino,项目名称:farmbot-web-app,代码行数:4,代码来源:actions.ts

示例9: success

 .then(() => success(t("Garden Saved.")));
开发者ID:RickCarlino,项目名称:farmbot-web-app,代码行数:1,代码来源:actions.ts


注:本文中的farmbot-toastr.success函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。