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

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

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

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

File diff suppressed because one or more lines are too long

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

@ -58,13 +58,11 @@ webpackJsonpCryptoPro([2],[
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1'); cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
cadesplugin.async_spawn(new GeneratorFunction(args, cb)); cb = String(new GeneratorFunction(args, cb));
}
}
function createObj(type) { cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'yield cadesplugin.CreateObjectAsync$1');
if (cadesplugin.CreateObjectAsync) {
return (new Function('', 'return yield cadesplugin.CreateObjectAsync(' + type + ')'))(); return 'cadesplugin.async_spawn(' + cb + ');';
} }
} }
@ -296,7 +294,6 @@ webpackJsonpCryptoPro([2],[
module.exports = { module.exports = {
execute: execute, execute: execute,
createObj: createObj,
subjectNameTagsTranslations: subjectNameTagsTranslations, subjectNameTagsTranslations: subjectNameTagsTranslations,
issuerNameTagsTranslations: issuerNameTagsTranslations, issuerNameTagsTranslations: issuerNameTagsTranslations,
parseCertInfo: parseCertInfo, 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( cadesplugin.then(
function () { function () {
if (canAsync) { if (canAsync) {
__webpack_require__.e/* nsure */(1/* empty */, function () { __webpack_require__.e/* nsure */(1, function () {
cryptoService = __webpack_require__(4); cryptoService = __webpack_require__(4);
finishLoading(); 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() { function isValidEDSSettings() {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
cryptoCommon.execute(function () { eval(cryptoCommon.execute(function () {
var result; var result;
try { try {
@ -179,7 +179,7 @@ function isValidEDSSettings() {
} }
resolve(); resolve();
}); }));
}); });
} }

View File

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