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


TypeScript is.is_Function函數代碼示例

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


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

示例1: build_Static

	function build_Static(static_, node, model, ctx, container, ctr, children) {
		var Ctor = static_.__Ctor,
			wasRendered = false,
			elements,
			compo,
			clone;

		if (Ctor != null) {
			clone = new Ctor(node, ctr);
		}
		else {
			clone = static_;

			for (var key in node)
				clone[key] = node[key];

			clone.parent = ctr;
		}

		var attr = clone.attr;
		if (attr != null) {
			for (var key in attr) {
				if (typeof attr[key] === 'function')
					attr[key] = attr[key]('attr', model, ctx, container, ctr, key);
			}
		}

		if (is_Function(clone.renderStart)) {
			clone.renderStart(model, ctx, container, ctr, children);
		}

		clone.ID = ++BuilderData.id;
		compo_addChild(ctr, clone);

		var i = ctr.components.length - 1;
		if (is_Function(clone.render)){
			wasRendered = true;
			elements = clone.render(model, ctx, container, ctr, children);
			arr_pushMany(children, elements);

			if (is_Function(clone.renderEnd)) {
				compo = clone.renderEnd(elements, model, ctx, container, ctr);
				if (compo != null) {
					// overriden
					ctr.components[i] = compo;
					compo.components  = clone.components == null
						? ctr.components.splice(i + 1)
						: clone.components
						;
				}
			}
		}

		return wasRendered === true ? null : clone;
	}
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:55,代碼來源:build_component.ts

示例2: customStatement_register

export function customStatement_register (name, handler){
	//@TODO should it be not allowed to override system statements, if, switch?
	custom_Statements[name] = is_Function(handler)
		? { render: handler }
		: handler
		;
};
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:7,代碼來源:statement.ts

示例3: dfr_isBusy

export function dfr_isBusy(dfr) {
    if (dfr == null || typeof dfr.then !== 'function') return false;

    // Class.Deferred
    if (is_Function(dfr.isBusy)) return dfr.isBusy();

    // jQuery Deferred
    if (is_Function(dfr.state)) return dfr.state() === 'pending';

    if (dfr instanceof Promise) {
        return true;
    }

    log_warn('Class, jQuery or native promise expected');
    return false;
}
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:16,代碼來源:dfr.ts

示例4: function

    constructor: function(compo, expression) {
        this.error = null;
        this.exports = [];
        this.onResolve = this.onResolve.bind(this);
        this.onReject = this.onReject.bind(this);
                
        var arr = expression_evalStatements(expression, compo.model, null, compo);
        var imax = arr.length,
            i = -1;

        this.await_ = imax;
        while(++i < imax) {
            var x = arr[i];
            if (x == null || is_Function(x.then) === false) {
                this.await_--;
                this.exports.push(x);
                continue;
            }

            x.then(this.onResolve, this.onReject);				
        }
        if (this.await_ === 0) {
            this.resolve(this.exports);
        }
    },
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:25,代碼來源:await.ts

示例5: selector_match

export function selector_match (node, selector, type?) {
    if (node == null) 
        return false;
    
    if (is_String(selector)) {
        if (type == null) 
            type = Dom[node.compoName ? 'CONTROLLER' : 'SET'];
        
        selector = selector_parse(selector, type);
    }

    var obj = selector.prop ? node[selector.prop] : node;
    if (obj == null) 
        return false;
    
    if (is_Function(selector.selector)) 
        return selector.selector(obj[selector.key]);
    
    // regexp
    if (typeof selector.selector !== 'string' && selector.selector.test != null) 
        return selector.selector.test(obj[selector.key]);
    
    // string | int
    /* jshint eqeqeq: false */
    return obj[selector.key] == selector.selector;
    /* jshint eqeqeq: true */
}
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:27,代碼來源:selector.ts

示例6: function

    processNode: function(node) {
        var stream = this.stream;
        if (is_Function(node.stringify)) {
            var str = node.stringify(stream);
            if (str != null) {
                stream.print('<mask>');
                stream.write(str);
                stream.print('</mask>');
            }
            return;
        }
        if (is_String(node.content)) {
            stream.print(node.content);
            return;
        }
        if (is_Function(node.content)){
            stream.print(node.content());
            return;
        }
        if (node.type === Dom.FRAGMENT) {
            this.process(node);
            return;
        }

        stream.print('<' + node.tagName);
        this.processAttr(node);

        if (isEmpty(node)) {
            if (html_isVoid(node)) {
                stream.print('>');
                return;
            }
            if (html_isSemiVoid(node)) {
                stream.print('/>');
                return;
            }
            stream.print('></' + node.tagName + '>');
            return;
        }
        stream.print('>');
        this.process(node.nodes);
        stream.print('</' + node.tagName + '>');
    },
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:43,代碼來源:stringify.ts

示例7: function

			injectableClass: function(mix){
				if (is_Function(mix)) {
					return createInjectableClassWrapper(mix, null);
				}
				if (is_Array(mix)) {
					return function (Ctor) {
						return createInjectableClassWrapper(Ctor, mix);
					};
				}
				throw Error('Invalid injectable args');
			}
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:11,代碼來源:Di.ts

示例8: _toTimingFn

function _toTimingFn(str) {
    if (str == null) {
        return Fns.linear;
    }
    var fn = Fns[str];
    if (is_Function(fn) === false) {
        log_error('Unsupported timing:' + str + '. Available:' + Object.keys(Fns).join(','));
        return Fns.linear;
    }
    return fn;
}
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:11,代碼來源:Tween.ts

示例9: function

 return function(val){
     if (current_ === val) {
         return;
     }
     current_ = val;
     var fn = ctr.setAttribute;
     if (is_Function(fn)) {
         fn.call(ctr, attrName, val);
         return;
     }
     ctr.attr[attrName] = val;
 };
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:12,代碼來源:bind.ts

示例10: listeners_on

listeners_on('config', function (config) {
    var modules = config.modules;
    if (modules == null) {
        return;
    }
    var fn = Loaders[modules];
    if (is_Function(fn) === false) {
        log_warn('Module system is not supported: ' + modules);
        return;
    }
    fn();
});
開發者ID:atmajs,項目名稱:MaskJS,代碼行數:12,代碼來源:loaders.ts


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