本文整理匯總了TypeScript中@utils/class/Dfr.class_Dfr.run方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript class_Dfr.run方法的具體用法?TypeScript class_Dfr.run怎麽用?TypeScript class_Dfr.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@utils/class/Dfr.class_Dfr
的用法示例。
在下文中一共展示了class_Dfr.run方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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);
});
});
}
示例2: 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);
});
});
};
示例3: 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);
}
});
};
示例4: 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);
});
});
}
示例5: 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);
});
});
},
示例6: 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);
});
});
}