本文整理匯總了TypeScript中@utils/obj.obj_setProperty函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript obj_setProperty函數的具體用法?TypeScript obj_setProperty怎麽用?TypeScript obj_setProperty使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了obj_setProperty函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: mask_config
export function mask_config (a?, b?, c?) {
var args = arguments,
length = args.length
if (length === 0) {
return __cfg;
}
if (length === 1) {
let x = args[0]
if (is_Object(x)) {
obj_extend(__cfg, x);
listeners_emit('config', x);
return;
}
if (is_String(x)) {
return obj_getProperty(__cfg, x);
}
}
if (length === 2) {
var prop = args[0];
if (obj_hasProperty(__cfg, prop) === false) {
log_warn('Unknown configuration property', prop);
}
let x = {};
obj_setProperty(x , prop, args[1]);
obj_setProperty(__cfg, prop, args[1]);
listeners_emit('config', x);
return;
}
}
示例2: function
return function(val){
if (current_ === val) {
return;
}
current_ = val;
obj_setProperty(ctr, property, val);
};
示例3: compo_attach
export function compo_attach (compo: Component, name: string, fn: Function) {
var current = obj_getProperty(compo, name);
if (is_Function(current)) {
var wrapper = function(){
var args = _Array_slice.call(arguments);
fn.apply(compo, args);
current.apply(compo, args);
};
obj_setProperty(compo, name, wrapper);
return;
}
if (current == null) {
obj_setProperty(compo, name, fn);
return;
}
throw Error('Cann`t attach ' + name + ' to not a Function');
}
示例4: builder_setCompoProps
export function builder_setCompoProps(compo, node, model, ctx, container) {
var props = node.props;
if (props == null) {
return;
}
for (var key in props) {
var val = props[key];
var x = is_Function(val)
? val('compo-prop', model, ctx, container, compo, key)
: val;
obj_setProperty(compo, key, x);
}
}
示例5: function
registerExport_: function(ctr, exportName, name, alias){
var module = this.module;
var prop = alias || name;
var obj = null;
if (this.async === 'async' && module.isBusy()) {
var dfr = new class_Dfr;
var that = this;
module.then(
function(){
var val = module.getExport(name);
if (val == null) {
that.logError_('Exported property is undefined: ' + name);
}
dfr.resolve(val);
},
function (error) {
dfr.reject(error)
}
);
obj = dfr;
} else {
obj = module.getExport(name);
}
if (obj == null) {
this.logError_('Exported property is undefined: ' + name);
return;
}
if (name === '*' && _opts.es6Modules && obj.default != null) {
var defaultOnly = true;
for (var key in obj) {
if (key === 'default' || key[0] === '_') continue;
defaultOnly = false;
break;
}
if (defaultOnly) {
warn_withNode('Default ONLY export is deprecated: `import * as foo from X`. Use `import foo from X`', this.node);
obj = obj.default;
}
}
if (ctr.scope == null) {
ctr.scope = {};
}
if (exportName === '*') {
throw new Error('Obsolete: unexpected exportName');
}
this.imports[exportName] = obj;
obj_setProperty(ctr.scope, prop, obj);
customTag_registerResolver(prop);
},
示例6: function
el_writeProps = function(el, node, props, model, ctx, container, ctr) {
for (var key in props) {
// if (key.indexOf('style.') === 0) {
// key = prepairStyleProperty(el, key)
// }
var mix = props[key],
val = is_Function(mix)
? getValByFn('prop', mix, key, model, ctx, el, ctr)
: mix;
if (val == null) {
continue;
}
obj_setProperty(el, key, val);
}
};
示例7: u_setOption
export function u_setOption (options, key, val) {
if (key === 'base' || key === 'nsBase') {
var path = path_normalize(val);
if (path[path.length - 1] !== '/') {
path += '/';
}
// Do not resolve root, as it will be resolved by base later
// @NextIteration: remove also path_resolveRoot, use instead resolveCurrent
// if (path[0] === '/') {
// path = path_combine(path_resolveRoot(), path);
// }
options[key] = path;
return this;
}
var current = obj_getProperty(options, key);
if (is_Object(current) && is_Object(val)) {
obj_extend(current, val);
return this;
}
obj_setProperty(options, key, val);
};
示例8: function
Component.Dom.addEventListener(el, event, function(){
var val = expression_eval_safe(expression, model, ctx, ctr, node);
obj_setProperty(model, ref, val);
});