@unavatar/core 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@unavatar/core",
3
3
  "description": "Get unified user avatar from social networks, including Instagram, SoundCloud, Telegram, Twitter, YouTube & more.",
4
4
  "homepage": "https://unavatar.io",
5
- "version": "0.0.2",
5
+ "version": "0.0.3",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -26,13 +26,18 @@ module.exports = ({ TMP_FOLDER, PUPPETEER_RANDOM_DIR }) => {
26
26
  return { PUPPETEER_DIR, DATA_DIR, CACHE_DIR, args }
27
27
  }
28
28
 
29
- const browser = createBrowser({
30
- args: getArgs().args,
31
- dumpio: false,
32
- pipe: true,
33
- puppeteer,
34
- waitForInitialPage: false
35
- })
36
-
37
- return () => browser
29
+ let browser
30
+
31
+ return () => {
32
+ if (!browser) {
33
+ browser = createBrowser({
34
+ args: getArgs().args,
35
+ dumpio: false,
36
+ pipe: true,
37
+ puppeteer,
38
+ waitForInitialPage: false
39
+ })
40
+ }
41
+ return browser
42
+ }
38
43
  }