提交 74d99f6b 编写于 作者: I isidor

Cache the 'vsda' import, because when the same missing module is imported...

Cache the 'vsda' import, because when the same missing module is imported multiple times, The ones after the first will not throw an error. And this will break the contract of the sign method
上级 6f9e9dd0
......@@ -4,13 +4,21 @@
*--------------------------------------------------------------------------------------------*/
import { ISignService } from 'vs/platform/sign/common/sign';
import { memoize } from 'vs/base/common/decorators';
export class SignService implements ISignService {
_serviceBrand: any;
// Cache the 'vsda' import, because when the same missing module is imported multiple times,
// the ones after the first will not throw an error. And this will break the contract of the sign method.
@memoize
private vsda(): Promise<typeof import('vsda')> {
return import('vsda');
}
async sign(value: string): Promise<string> {
try {
const vsda = await import('vsda');
const vsda = await this.vsda();
const signer = new vsda.signer();
if (signer) {
return signer.sign(value);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册