-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
2 lines (2 loc) · 2.18 KB
/
index.ts
1
2
function ___$insertStyle(e){if(e&&"undefined"!=typeof window){const t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}Object.defineProperty(exports,"__esModule",{value:!0});var react=require("react");function __awaiter(e,a,i,u){return new(i=i||Promise)(function(r,t){function n(e){try{c(u.next(e))}catch(e){t(e)}}function o(e){try{c(u.throw(e))}catch(e){t(e)}}function c(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(n,o)}c((u=u.apply(e,a||[])).next())})}function __generator(n,o){var c,a,i,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(r){return function(e){var t=[r,e];if(c)throw new TypeError("Generator is already executing.");for(;u;)try{if(c=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,(t=i?[2&t[0],i.value]:t)[0]){case 0:case 1:i=t;break;case 4:return u.label++,{value:t[1],done:!1};case 5:u.label++,a=t[1],t=[0];continue;case 7:t=u.ops.pop(),u.trys.pop();continue;default:if(!(i=0<(i=u.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){u=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3]))u.label=t[1];else if(6===t[0]&&u.label<i[1])u.label=i[1],i=t;else{if(!(i&&u.label<i[2])){i[2]&&u.ops.pop(),u.trys.pop();continue}u.label=i[2],u.ops.push(t)}}t=o.call(n,u)}catch(e){t=[6,e],a=0}finally{c=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}var useCryptoPriceController=function(e){var r=e.symbol,e=react.useState(""),t=e[0],n=e[1];return react.useEffect(function(){__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,fetch("https://api.binance.com/api/v3/ticker/price?symbol=".concat(r,"USDT"))];case 1:return[4,e.sent().json()];case 2:return t=e.sent(),n(t.price),[3,4];case 3:return t=e.sent(),console.error(t),[3,4];case 4:return[2]}})})},[r]),{price:t}},index={useCryptoPriceController:useCryptoPriceController};exports.default=index;
//# sourceMappingURL=index.ts.map