本文整理汇总了TypeScript中@utils/class/Dfr.class_Dfr类的典型用法代码示例。如果您正苦于以下问题:TypeScript class_Dfr类的具体用法?TypeScript class_Dfr怎么用?TypeScript class_Dfr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了class_Dfr类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: get
function get(fn, path, ctr) {
path = path_resolveUrl(path, Module.resolveLocation(ctr));
var dfr = Cache[path];
if (dfr !== void 0) {
return dfr;
}
dfr = new class_Dfr();
fn(path, dfr.pipeCallback());
return dfr;
}
示例2: renderer_renderAsync
export function renderer_renderAsync (template, model?, ctx?, container?, ctr?): PromiseLike<HTMLElement> {
if (ctx == null || ctx.constructor !== builder_Ctx)
ctx = new builder_Ctx(ctx);
if (ctr == null) ctr = new Component();
var dom = renderer_render(template, model, ctx, container, ctr),
dfr = new class_Dfr();
if (ctx.async === true) {
ctx.done(function() {
dfr.resolve(dom, ctr);
});
} else {
dfr.resolve(dom, ctr);
}
return dfr;
};
示例3: build_script
function build_script(path, opts, done) {
return class_Dfr.run(function(resolve, reject){
_file_get(path)
.fail(reject)
.done(function(str){
var script = 'var module = { exports: null }\n';
script += str + ';\n';
script += 'mask.Module.registerModule(module.exports, new mask.Module.Endpoint("' + path + '", "script"))';
resolve(script);
});
});
}
示例4: function
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);
});
});
};
示例5: tools_build
export function tools_build (template, path, opts_?){
var opts = obj_extendDefaults(opts_, optionsDefault);
return class_Dfr.run(function(resolve, reject){
tools_getDependencies(template, path, { flattern: true })
.fail(reject)
.done(function(deps){
build(deps, opts, complete, reject);
});
function complete (out) {
out.mask += '\n' + template;
resolve(out);
}
});
};
示例6: function
ModuleMidd.parseMaskContent = function (mix: string | any, path: string): PromiseLike<{ [key: string]: any }> {
return class_Dfr.run((resolve, reject) => {
new ModuleMask(path || '').preprocess_(mix, function(
error,
exports
) {
if (error) {
reject(error);
return;
}
resolve(exports);
});
});
}
示例7: function
mask: function(path, opts, done){
return class_Dfr.run(function(resolve, reject) {
_file_get(path)
.fail(reject)
.done(function(str) {
// remove all remote styles
var ast = mask_TreeWalker.walk(str, function(node){
if (node.tagName === 'link' && node.attr.href) {
return { remove: true };
}
});
ast = jMask('module')
.attr('path', path)
.append(ast);
var str = mask_stringify(ast[0], {
indent: opts.minify ? 0 : 4
});
resolve(str);
});
});
},
示例8: build_data
function build_data(path, opts, done) {
return class_Dfr.run(function(resolve, reject){
_file_get(path)
.fail(reject)
.done(function(mix){
var json;
try {
json = typeof mix === 'string'
? JSON.parse(mix)
: mix;
} catch (error) {
reject(error);
return;
}
var str = JSON.stringify(json, null, opts.minify ? 4 : void 0);
var script = 'module = { exports: ' + str + ' }\n'
+ 'mask.Module.registerModule(module.exports, new mask.Module.Endpoint("' + path + '", "json"))';
resolve(script);
});
});
}