Skip to content

Commit

Permalink
feat: add (friendly) warning when used in the browser
Browse files Browse the repository at this point in the history
  • Loading branch information
advaiyalad committed May 26, 2021
1 parent 519a1d4 commit 3b4722f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@ import browserEnvironment from "./env-browser.js";

yahooFinance._env = browserEnvironment;

// NOTE: The repo name is hardcoded, see #167
console.warn(
"⚠️ WARNING! This package (i.e. `yahoo-finance2`) is being used in the browser.",
"Trying to use this may not work because of CORS. Be aware of that (and don't file issues for help with that).",
"You can use a proxy to make CORS errors disappear, but we will not help you with that.",
"Please read the README (https://github.com/gadicc-node-yahoo-finance2) for more details."
);

export default yahooFinance;

0 comments on commit 3b4722f

Please sign in to comment.