本文整理汇总了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);
});