本文整理汇总了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;
}
示例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
;
};
示例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;
}
示例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);
}
},
示例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 */
}
示例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 + '>');
},
示例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');
}
示例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;
}
示例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;
};
示例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();
});