當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript util.isFunction函數代碼示例

本文整理匯總了TypeScript中util.isFunction函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isFunction函數的具體用法?TypeScript isFunction怎麽用?TypeScript isFunction使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了isFunction函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: return

            return (...value) => {
                let pattern = fn.apply(fn, value)
                let runFns = []
                pattern.forEach((v, i) => {
                    let lastPattern = pattern[i - 1]
                    if (isFunction(v) && lastPattern && !isFunction(lastPattern))
                        runFns.push(v)

                })
                if (runFns.length == 0) {
                    let l = pattern.length
                    if (isFunction(pattern[l - 1]) && isFunction(pattern[l - 2])) {
                        runFns.push(pattern[l - 1])
                    }
                }
                runFns.forEach(f => f.apply(fn, value))
            }
開發者ID:gleba,項目名稱:alak,代碼行數:17,代碼來源:match.ts

示例2: openMenuPopup

export async function openMenuPopup(event: MouseEvent, popup: React.ReactNode | ((rowItem: any) => Promise<React.ReactNode>), rowItem: any = null) {
    var elemDiv = document.createElement('div');
    $(elemDiv).addClass("buhta-popup-menu");
    document.body.appendChild(elemDiv);

    let scrollTop = $(window).scrollTop();
    let scrollLeft = $(window).scrollLeft();
    let left = event.clientX + 5 + scrollLeft!;
    let top = event.clientY + 5 + scrollTop!;

    if (isFunction(popup)) {
        ReactDOM.render(await (popup as any)(rowItem), elemDiv);
    }
    else {
        ReactDOM.render(popup as any, elemDiv);
    }

}
開發者ID:KostiaSA,項目名稱:BuhtaClient2019,代碼行數:18,代碼來源:openMenuPopup.ts

示例3: patternMatch

export function patternMatch(arg) {
    let a = arg
    if (a.length >= 2) {
        let p = parsePattern(a)
        return (...value) => {

            let matchFn = p.map[value.join(',')]
            if (!matchFn) matchFn = p.map[value[0]]
            if (matchFn) matchFn.apply(matchFn, value)
            else if (p.else) p.else.apply(matchFn, value)
        }
    } else {
        a = a[0]
        if (isFunction(a)) {
            let fn = a as any as Function
            return (...value) => {
                let pattern = fn.apply(fn, value)
                let runFns = []
                pattern.forEach((v, i) => {
                    let lastPattern = pattern[i - 1]
                    if (isFunction(v) && lastPattern && !isFunction(lastPattern))
                        runFns.push(v)

                })
                if (runFns.length == 0) {
                    let l = pattern.length
                    if (isFunction(pattern[l - 1]) && isFunction(pattern[l - 2])) {
                        runFns.push(pattern[l - 1])
                    }
                }
                runFns.forEach(f => f.apply(fn, value))
            }
        }
    }
    return v => {
        console.error("patternMatch unsupported pattern", v, arg)
    }
}
開發者ID:gleba,項目名稱:alak,代碼行數:38,代碼來源:match.ts

示例4:

                pattern.forEach((v, i) => {
                    let lastPattern = pattern[i - 1]
                    if (isFunction(v) && lastPattern && !isFunction(lastPattern))
                        runFns.push(v)

                })
開發者ID:gleba,項目名稱:alak,代碼行數:6,代碼來源:match.ts

示例5: isFunction

export function isFunction(value: any) {
    return isFunc(value);
}
開發者ID:KostiaSA,項目名稱:BuhtaClient2019,代碼行數:3,代碼來源:isFunction.ts


注:本文中的util.isFunction函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。