const origin = "http://172.16.8.4";

// 发送消息
export function postMessage(data) {
  window.parent.postMessage(
    {
      ...data,
      source: "InteractiveVideo",
      toolType: "InteractiveVideoEditor",
    },
    origin
  );
}

// 反馈操作成功
export function postMessageOk(callBackType) {
  postMessage({
    msgType: "ok",
    content: {
      callBackType,
      msg: "操作成功",
    },
  });
}

// 反馈操作失败
export function postMessageFail(callBackType, msg) {
  postMessage({
    msgType: "fail",
    content: {
      callBackType,
      msg: `操作失败:${msg}`,
    },
  });
}
