import MESSAGE_ENUM from '@/uilts/messageCenter/messageEnum'
import messageCenter from "@/uilts/messageCenter";
import { getQueryString } from '@/uilts/help'
const iframeId = getQueryString('iframeId')

const dom = {
    // ---- 获取推文文案 ----
    getTweetText({ tweetId }, overTime) {
        return new Promise((res, rej) => {
            messageCenter.send({
                info: {
                    actionType: MESSAGE_ENUM.IFRAME_DOM_GET_TWEET_TEXT,
                    iframeId //用于告诉父窗口会传消息给哪个iframe
                },
                data: {
                    tweetId
                },
                overTime,
                callback: (data) => {
                    res(data);
                },
                failback: (e) => {
                    rej(e)
                }
            })
        })
    }
}

export default dom
