patchrome 0.1.0 → 0.1.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/engine.js +3 -2
- package/dist/focus.js +2 -2
- package/package.json +1 -1
package/dist/engine.js
CHANGED
|
@@ -7,8 +7,9 @@ import { chromium } from "patchright";
|
|
|
7
7
|
import { keepFocusDuring } from "./focus.js";
|
|
8
8
|
import { readOriginStorageInPage } from "./origin-storage.js";
|
|
9
9
|
const pageOpenTimeoutMs = 15_000;
|
|
10
|
-
// Chrome
|
|
11
|
-
|
|
10
|
+
// Chrome activates 400-800ms into launch, before launch resolves. A longer grace sends the user's own
|
|
11
|
+
// Dock clicks on Chrome back to the previous app.
|
|
12
|
+
const focusGraceMs = 500;
|
|
12
13
|
const devToolsPortWaitMs = 10_000;
|
|
13
14
|
const extensionWorkerWaitMs = 10_000;
|
|
14
15
|
// src/ and dist/ both sit one level below the package root, next to extension/.
|
package/dist/focus.js
CHANGED
|
@@ -14,8 +14,8 @@ async function frontmostBundleId() {
|
|
|
14
14
|
}
|
|
15
15
|
// macOS activates Chrome when its first window appears, so keystrokes meant for the user's editor land in
|
|
16
16
|
// the address bar. Chrome has no flag to launch in the background, and --no-startup-window stalls Playwright,
|
|
17
|
-
// so this watches the launch and reactivates whichever app was in front.
|
|
18
|
-
//
|
|
17
|
+
// so this watches the launch and reactivates whichever app was in front. The watch covers the launch and a short
|
|
18
|
+
// grace after it, since it cannot tell Chrome raising itself from the user clicking Chrome. `open -b` needs no Apple Events
|
|
19
19
|
// permission, unlike osascript.
|
|
20
20
|
export async function keepFocusDuring(launch, graceMs) {
|
|
21
21
|
if (process.platform !== "darwin")
|
package/package.json
CHANGED