2020-01-10 11:19:21 +03:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2021-03-08 02:24:04 +03:00
|
|
|
exports.transports = void 0;
|
2020-04-25 10:54:54 +03:00
|
|
|
var hidCache = null;
|
|
|
|
var hidWrapper = Object.freeze({
|
|
|
|
create: function () {
|
|
|
|
// Load the library if not loaded
|
|
|
|
if (hidCache == null) {
|
|
|
|
hidCache = new Promise(function (resolve, reject) {
|
|
|
|
try {
|
|
|
|
var hid = require("@ledgerhq/hw-transport-node-hid");
|
|
|
|
if (hid.create == null) {
|
|
|
|
resolve(hid["default"]);
|
|
|
|
}
|
|
|
|
resolve(hid);
|
|
|
|
}
|
|
|
|
catch (error) {
|
|
|
|
reject(error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
/*
|
|
|
|
hidCache = import("@ledgerhq/hw-transport-node-hid").then((hid) => {
|
|
|
|
if (hid.create == null) { return hid["default"]; }
|
|
|
|
return hid;
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
return hidCache.then(function (hid) {
|
|
|
|
return hid.create();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
exports.transports = Object.freeze({
|
|
|
|
"hid": hidWrapper,
|
|
|
|
"default": hidWrapper
|
|
|
|
});
|
2020-07-13 15:03:56 +03:00
|
|
|
//# sourceMappingURL=ledger-transport.js.map
|