создание асинхронных функций на лету

This commit is contained in:
vgoma 2017-11-29 12:25:44 +03:00
parent bdb36572f1
commit 811babb9f3
8 changed files with 23 additions and 32 deletions

17
dist/1.crypto-pro.js vendored
View File

@ -177,7 +177,7 @@ webpackJsonpCryptoPro([1],[
* */
function isValidEDSSettings() {
return new Promise(function (resolve, reject) {
cryptoCommon.execute(function () {
eval(cryptoCommon.execute(function () {
var result;
try {
@ -187,7 +187,7 @@ webpackJsonpCryptoPro([1],[
}
resolve();
});
}));
});
}
@ -614,14 +614,12 @@ webpackJsonpCryptoPro([1],[
args = (args && args[1]) || '';
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
cadesplugin.async_spawn(new GeneratorFunction(args, cb));
}
}
function createObj(type) {
if (cadesplugin.CreateObjectAsync) {
return (new Function('', 'return yield cadesplugin.CreateObjectAsync(' + type + ')'))();
cb = String(new GeneratorFunction(args, cb));
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'yield cadesplugin.CreateObjectAsync$1');
return 'cadesplugin.async_spawn(' + cb + ');';
}
}
@ -853,7 +851,6 @@ webpackJsonpCryptoPro([1],[
module.exports = {
execute: execute,
createObj: createObj,
subjectNameTagsTranslations: subjectNameTagsTranslations,
issuerNameTagsTranslations: issuerNameTagsTranslations,
parseCertInfo: parseCertInfo,

File diff suppressed because one or more lines are too long

13
dist/2.crypto-pro.js vendored
View File

@ -57,14 +57,12 @@ webpackJsonpCryptoPro([2],[
args = (args && args[1]) || '';
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
cadesplugin.async_spawn(new GeneratorFunction(args, cb));
}
}
function createObj(type) {
if (cadesplugin.CreateObjectAsync) {
return (new Function('', 'return yield cadesplugin.CreateObjectAsync(' + type + ')'))();
cb = String(new GeneratorFunction(args, cb));
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'yield cadesplugin.CreateObjectAsync$1');
return 'cadesplugin.async_spawn(' + cb + ');';
}
}
@ -296,7 +294,6 @@ webpackJsonpCryptoPro([2],[
module.exports = {
execute: execute,
createObj: createObj,
subjectNameTagsTranslations: subjectNameTagsTranslations,
issuerNameTagsTranslations: issuerNameTagsTranslations,
parseCertInfo: parseCertInfo,

File diff suppressed because one or more lines are too long

2
dist/crypto-pro.js vendored
View File

@ -178,7 +178,7 @@ var CryptoPro =
cadesplugin.then(
function () {
if (canAsync) {
__webpack_require__.e/* nsure */(1/* empty */, function () {
__webpack_require__.e/* nsure */(1, function () {
cryptoService = __webpack_require__(4);
finishLoading();
});

File diff suppressed because one or more lines are too long

View File

@ -169,7 +169,7 @@ Certificate.prototype.hasExtendedKeyUsage = cryptoCommon.hasExtendedKeyUsage;
* */
function isValidEDSSettings() {
return new Promise(function (resolve, reject) {
cryptoCommon.execute(function () {
eval(cryptoCommon.execute(function () {
var result;
try {
@ -179,7 +179,7 @@ function isValidEDSSettings() {
}
resolve();
});
}));
});
}

View File

@ -48,14 +48,12 @@ function execute(cb) {
args = (args && args[1]) || '';
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
cadesplugin.async_spawn(new GeneratorFunction(args, cb));
}
}
function createObj(type) {
if (cadesplugin.CreateObjectAsync) {
return (new Function('', 'return yield cadesplugin.CreateObjectAsync(' + type + ')'))();
cb = String(new GeneratorFunction(args, cb));
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'yield cadesplugin.CreateObjectAsync$1');
return 'cadesplugin.async_spawn(' + cb + ');';
}
}
@ -287,7 +285,6 @@ function isValidCadesVersion(version) {
module.exports = {
execute: execute,
createObj: createObj,
subjectNameTagsTranslations: subjectNameTagsTranslations,
issuerNameTagsTranslations: issuerNameTagsTranslations,
parseCertInfo: parseCertInfo,