• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript config.mask_config函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@core/api/config.mask_config函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mask_config函数的具体用法?TypeScript mask_config怎么用?TypeScript mask_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mask_config函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: UTest

import { mask_config } from '@core/api/config';
import { Module } from '@core/feature/modules/exports';
import { renderer_renderAsync } from '@core/renderer/exports';
import { listeners_on, listeners_off } from '@core/util/listeners';

UTest({
	$before () {
		// use default module loader
		mask_config('modules', 'default');
		Module.cfg('moduleResolution', 'node');
	},
	$after () {
        Module.cfg('moduleResolution', 'classic');
        listeners_off('error');
	},

	async 'should load default file in node_modules' () {
		let dom = await renderer_renderAsync(`
            import Foo from '/test/tmpl/npm/foo.mask';

            Foo;
        `);
        
        return UTest.domtest(dom, `
            find ('h4') > text ('EmptyPackage');
        `);
	},
	async 'should fail loading' () {
        var errors = [];
        
		listeners_on('error', assert.await((error) => errors.push(error)));
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:npm.spec.ts


示例2: UTest

import { mask_config } from '@core/api/config'
import { renderer_render, renderer_renderAsync } from '@core/renderer/exports'
import '@core/feature/methods/exports'
import { Module } from '@core/feature/modules/exports'

UTest({
	$teardown () {
		mask_config('getScript', null);
		Module.clearCache();
	},
	'should get instance from define args' () {
		class Foo {
			load () { }
		};

		mask_config('getScript', async path => {
			return new Foo();
		});


		var template = `
			import * as IFoo from 'Foo.js';

			define FooCompo (foo: IFoo) {
				function onRenderStart () {
					this.emitOut('fooSignal', foo);	
				}
			}

			FooCompo;
		`;
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:di.spec.ts


示例3: mask_config

import { mask_config } from '@core/api/config';
import { renderer_renderAsync, renderer_render } from '@core/renderer/exports';
import { Compo } from '@compo/exports';
import { customTag_define } from '@core/custom/exports';
import '@core/feature/modules/exports'

// use default module loader
mask_config('modules', 'default');

UTest({
	async 'should test sync module loading' () {
		var Files = {
			'MyComponents.mask': `
				module path='A.mask' {
					h1 > 'A'
				}
				module path='B.mask' {
					h1 > 'B'
				}
				module path='C.mask' {
					h1 > 'C'
				}
			`,
			'MyLetter.mask': `
				import * as Template from './B';
				Template;
			`
		};

		var _queue = [];
		mask_config('getFile', (path) => {
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:async.spec.ts


示例4: function

    'default': function () {
        __cfg.getScript = __cfg.getFile = __cfg.getStyle = null;
    },
    'include': function () {
        __cfg.getScript = getter('js');
        __cfg.getStyle  = getter('css');
        __cfg.getFile   = getter('load');

        var lib = include;
        function getter(name) {
            return function(path){
                return class_Dfr.run(function(resolve, reject){
                    lib.instance('/')[name](path + '::Module').done(function(resp){
                        if ('css' === name) {
                            return resolve();
                        }
                        if ('js' === name) {
                            return resolve(resp.Module);
                        }
                        resolve(resp[name].Module);
                    });
                });
            };
        }
    }
};

if (typeof include !== 'undefined' && is_Function(include && include.js)) {
    mask_config('modules', 'include');
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:30,代码来源:loaders.ts


示例5: eq_

		var clean = txt => txt.replace(/\s/g, '');

		eq_(clean(str), clean(tmpl));
	},
	'should preprocess script' () {
		var tmpl = `
			JustAContainer {
				slot change () {
					this.$.text('B');
				}
				button x-tap = change > 'A'
			}			
		`;
		
		mask_config('preprocessor.script', function(body){
			return body.replace('B', 'C');
        });
        
        let dom = renderer_render(tmpl);
        mask_config('preprocessor.script', null);        
        return UTest.domtest(dom, `
            find (button) {
                text A;
                do click;
                text C;
            }
        `);
	}
});

开发者ID:atmajs,项目名称:MaskJS,代码行数:29,代码来源:function.spec.ts


示例6: UTest

import { mask_config } from '@core/api/config';
import { Module } from '@core/feature/modules/exports';
import { renderer_renderAsync } from '@core/renderer/exports';

UTest({
	$teardown () {
		mask_config('getFile', null);
		mask_config('getScript', null);
	},

	async 'should load script' () {
		var Foo = {
			get name () { return 'FooTest' }
		};

		Module
			.cfg('prefixes.services', '/src/services/{0}.js')
			.cfg('ext.script', 'js')
			;
		mask_config('getScript', assert.await(async path => {
			has_(path, '/src/services/FooService.js');			
			return Foo;
		}));
		let dom = await renderer_renderAsync(`
            import * as Foo from '@services/FooService';
            h3 > '~[Foo.name]'
        `);
			
        return UTest.domtest(dom, `
            find('h3') > text FooTest;
        `);
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:prefixes.spec.ts


示例7: UTest

import { mask_config } from '@core/api/config';
import { renderer_renderAsync } from '@core/renderer/exports';
import { Module } from '@core/feature/modules/exports';

UTest({
	$teardown () {
		mask_config('getFile', null);
		mask_config('getScript', null);
	},

	async 'should load mask' () {
		mask_config('getFile', assert.await(async path => {
			has_(path, 'controls/Foo.mask');
			var template = 'define Foo { h3 > "FooTest" }';
			return template;
		}));
		let dom = await renderer_renderAsync(`
            import Foo from controls is mask;
            Foo;
        `);
			
        return UTest.domtest(dom, `
            find('h3') > text FooTest;
        `);
	},
	async 'should load script' () {
		Module.cfg('ext.script', 'es6');
		mask_config('getScript', assert.await(async path => {
			has_(path, 'services/Foo.es6');

			var service = {
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:ns.spec.ts


示例8: UTest

import { mask_config } from '@core/api/config';
import { Module } from '@core/feature/modules/exports';
import { renderer_renderAsync } from '@core/renderer/exports';

UTest({
	$teardown () {
		mask_config('getScript', null);
		mask_config('getFile', null);
		Module.clearCache();
	},
	async 'should get instance from define args' () {
		class Foo {
			checkIt () { return 'checkThis' }
		};

		mask_config('getScript', async path => {
			return new Foo()
		});

		var template = `
			import * as Foo from 'Foo.js';
			section > Foo > span > '~[this.checkIt()]'
		`;
		var dom = await renderer_renderAsync(template);

		return UTest.domtest(dom, `
			find ('span') > text ('checkThis');
		`)
	},
	async 'should get mask component in js' () {
		
开发者ID:atmajs,项目名称:MaskJS,代码行数:30,代码来源:js-compo.spec.ts


示例9: mask_config

				width: 5,
				style: 'dotted'
			},
			styles: {
				'.foo': {
					'border-top-width': '5px',
					'border-top-style' : 'dotted'
				}
			},
			count: 1,
			isInterpolated: true
		});
	},
	async 'check preprocessor' () {
		mask_config('preprocessor.style', function(body){
			return body.replace('red', 'green');
		});
		var template = `
			div {
				style scoped {
					:host {
						background: red;
					}
				}
			}
		`;
		let div = await renderer_renderAsync(template);
			
        var str = $('body').children('style').last().text();
        hasNot_(str, 'red');
        has_   (str, 'green');
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:style.spec.ts



注:本文中的@core/api/config.mask_config函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript delegate.CoreBlockDelegate类代码示例发布时间:2022-05-28
下一篇:
TypeScript @core.core类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap