本文整理匯總了TypeScript中core/util/types.isFunction函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isFunction函數的具體用法?TypeScript isFunction怎麽用?TypeScript isFunction使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isFunction函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: _emit_callback
protected _emit_callback(): void {
if (this.callback != null) {
if (isFunction(this.callback))
this.callback(this)
else
this.callback.execute(this, {})
}
}
示例2: callback
this.connect(this.properties.selected.change, () => {
const {callback} = this
if (callback != null) {
if (isFunction(callback))
callback(this)
else
callback.execute(this)
}
})
示例3: function
const _strftime = function(t, format) {
if (isFunction(format)) {
return format(t);
} else {
// Python's datetime library augments the microsecond directive %f, which is not
// supported by the javascript library timezone: http://bigeasy.github.io/timezone/.
// Use a regular expression to replace %f directive with microseconds.
// TODO: what should we do for negative microsecond strings?
const microsecond_replacement_string = sprintf("$1%06d", _us(t));
format = format.replace(/((^|[^%])(%%)*)%f/, microsecond_replacement_string);
if (format.indexOf("%") === -1) {
// timezone seems to ignore any strings without any formatting directives,
// and just return the time argument back instead of the string argument.
// But we want the string argument, in case a user supplies a format string
// which doesn't contain a formatting directive or is only using %f.
return format;
}
return tz(t, format);
}
};