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