@open-wa/wa-automate 4.62.0 → 4.62.1
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/dist/controllers/browser.js +17 -13
- package/package.json +1 -1
@@ -73,19 +73,23 @@ function initPage(sessionId, config, qrManager, customUserAgent, spinner, _page,
|
|
73
73
|
browser = yield initBrowser(sessionId, config, spinner);
|
74
74
|
spinner === null || spinner === void 0 ? void 0 : spinner.info(`Browser launched: ${((0, tools_1.now)() - startBrowser).toFixed(0)}ms`);
|
75
75
|
waPage = yield getWAPage(browser);
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
76
|
+
if (process.stdin.setRawMode && typeof process.stdin.setRawMode == "function") {
|
77
|
+
readline.emitKeypressEvents(process.stdin);
|
78
|
+
process.stdin.setRawMode(true);
|
79
|
+
console.log('Press "s" to take a screenshot. Press "Ctrl+C" to quit.');
|
80
|
+
process.stdin.on('keypress', (str, key) => __awaiter(this, void 0, void 0, function* () {
|
81
|
+
if (key.name === 's') {
|
82
|
+
const path = `./screenshot_${config.sessionId || "session"}_${Date.now()}.png`;
|
83
|
+
console.log(`Taking screenshot: ${path} ...`);
|
84
|
+
yield waPage.screenshot({ path });
|
85
|
+
}
|
86
|
+
if (key.ctrl && key.name === 'c') {
|
87
|
+
process.exit();
|
88
|
+
}
|
89
|
+
}));
|
90
|
+
}
|
91
|
+
else
|
92
|
+
console.log("Unable to set raw mode on stdin. Keypress events will not be emitted. You cannot take a screenshot by pressing 's' during launch.");
|
89
93
|
}
|
90
94
|
//@ts-ignore
|
91
95
|
yield (typeof waPage._client === 'function' && waPage._client() || waPage._client).send('Network.setBypassServiceWorker', { bypass: true });
|
package/package.json
CHANGED