当前位置: 首页>>代码示例>>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;未经允许,请勿转载。