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


TypeScript jb-core.jb類代碼示例

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


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

示例1: addProperty

	addProperty(path) {
		var parent = profileFromPath(parentPath(path));
		if (this.paramType(path) == 'data')
			return jb.writeValue(profileRefFromPath(path),'');
		var param = this.paramDef(path);
		jb.writeValue(profileRefFromPath(path),param.defaultValue || {$: ''});
	}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:7,代碼來源:studio-tgp-model.ts

示例2: restoreWindowEvent

export function restoreWindowEvent(events) {
	events = jb.toarray(events);
	for (var i = 0; i < events.length; i++) {
		window['on' + events[i]] = jb.path(jbart, ['windowOrigEvents', events[i]]);
		jb.path(jbart, ['windowOrigEvents', events[i]], null);
	}
}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:7,代碼來源:jb-ui-utils.ts

示例3: wrap

	wrap(path,args) {
		var comp = getComp(args.compName);
		var firstParam = jb_compParams(comp).filter(p=>p.composite)[0];
		if (firstParam) {
			var result = jb.extend({ $: args.compName }, jb.obj(firstParam.id, [profileFromPath(path)]));
			jb.writeValue(profileRefFromPath(path),result);
		}
	}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:8,代碼來源:studio-tgp-model.ts

示例4: isCompNameOfType

	isCompNameOfType(name,type) {
		var _jbart = jbart_base().comps[name] ? jbart_base() : jbart;
		if (name && _jbart.comps[name]) {
			while (!_jbart.comps[name].type && jb.compName(jbart.comps[name].impl))
				name = jb.compName(_jbart.comps[name].impl);
			return (_jbart.comps[name].type || '').indexOf(type) == 0;
		}
	}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:8,代碼來源:studio-tgp-model.ts

示例5: getStyleComp

	getStyleComp(path) {
	    var style = this.val(path);
	    var compName = jb.compName(style);
	    if (compName == 'customStyle')
	      return { type: 'inner', path: path, style : style }
		var comp = compName && getComp(compName);
		if (jb.compName(comp.impl) == 'customStyle') 
	      return { type: 'global', path: compName, style: comp.impl, innerPath: path }
	}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:9,代碼來源:studio-tgp-model.ts

示例6: closest

	impl: (ctx,pathRef) => {
		var path = jb.val(pathRef);
		var closest_path = closest(path);

		if (path && path != closest_path) {
			jb.writeValue(pathRef,closest_path);
//			jb_ui.apply(ctx);
		}
	}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:9,代碼來源:studio-path.ts

示例7: addArrayItem

	addArrayItem(path,args) {
		var val = profileFromPath(path);
		var toAdd = args.toAdd || {$:''};
		if (Array.isArray(val)) {
			val.push(toAdd);
			return { newPath: path + '~' + (val.length-1) }
		}
		else if (!val) {
			jb.writeValue(profileRefFromPath(path),toAdd);
		} else {
			jb.writeValue(profileRefFromPath(path),[val].concat(toAdd));
			return { newPath: path + '~1' }
		}
	}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:14,代碼來源:studio-tgp-model.ts

示例8: Probe

  impl: (ctx,control,staticPath,expectedDynamicCounter,probeCheck)=> {

    // var probProf = findProbeProfile(control.profile);
    // if (!probProf)
    //   return failure('no prob prof');
     // ********** dynamic counter
    var testId = ctx.vars.testID;
    var full_path = testId + '~' + staticPath;
    var probeRes = new Probe(jb.ctx(ctx,{ profile: control.profile, comp: testId, path: '' } ),true)
      .runCircuit(full_path);
    return probeRes.then(res=>{
          try {
            var match = Array.from(res.element.querySelectorAll('[jb-ctx]'))
            .filter(e=> {
              var ctx2 = jbart.ctxDictionary[e.getAttribute('jb-ctx')];
              return ctx2.path == full_path || (ctx2.componentContext && ctx2.componentContext.callerPath == full_path)
            })
            if (match.length != expectedDynamicCounter)
              return failure('dynamic counter', 'jb-path error: ' + staticPath + ' found ' + (match || []).length +' times. expecting ' + expectedDynamicCounter + ' occurrences');
            if (!res.finalResult[0] || !probeCheck(res.finalResult[0].in) )
                return failure('probe');
          } catch(e) {
            return failure('exception');
          }
          return success();
    })

    function failure(part,reason) { return { id: testId, title: testId + '- ' + part, success:false, reason: reason } };
    function success() { return { id: testId, title: testId, success: true } };

  }
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:31,代碼來源:studio-testers.ts

示例9: wrapWithArray

	wrapWithArray(path) {
		var val = profileFromPath(path);
		if (val && !Array.isArray(val)) {
			jb.writeValue(profileRefFromPath(path),[val]);
			return { newPath: path + '~0' }
		}
	}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:7,代碼來源:studio-tgp-model.ts

示例10: makeLocal

	makeLocal(path) {
		var compName = this.compName(path);
		var comp = compName && getComp(compName);
		if (!compName || !comp || typeof comp.impl != 'object') return;
		var res = JSON.stringify(comp.impl, (key, val) => typeof val === 'function' ? ''+val : val , 4);

		var profile = profileFromPath(path);
		// inject conditional param values
		jb_compParams(comp).forEach(p=>{ 
				var pUsage = '%$'+p.id+'%';
				var pVal = '' + (profile[p.id] || p.defaultValue || '');
				res = res.replace(new RegExp('{\\?(.*?)\\?}','g'),(match,condition_exp)=>{ // conditional exp
						if (condition_exp.indexOf(pUsage) != -1)
							return pVal ? condition_exp : '';
						return match;
					});
		});
		// inject param values 
		jb_compParams(comp).forEach(p=>{ 
				var pVal = '' + (profile[p.id] || p.defaultValue || ''); // only primitives
				res = res.replace(new RegExp(`%\\$${p.id}%`,'g') , pVal);
		});

		jb.writeValue(profileRefFromPath(path),evalProfile(res));
	}
開發者ID:ArtwareSoft,項目名稱:jbart5-ng,代碼行數:25,代碼來源:studio-tgp-model.ts


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