Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate src/FrameManager to TypeScript #5773

Merged
merged 1 commit into from Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/DOMWorld.ts
Expand Up @@ -22,18 +22,19 @@ import {JSHandle, ElementHandle} from './JSHandle';
import {ExecutionContext} from './ExecutionContext';
import {TimeoutSettings} from './TimeoutSettings';
import {MouseButtonInput} from './Input';
import {FrameManager, Frame} from './FrameManager';

const readFileAsync = helper.promisify(fs.readFile);

interface WaitForSelectorOptions {
export interface WaitForSelectorOptions {
visible?: boolean;
hidden?: boolean;
timeout?: number;
}

export class DOMWorld {
_frameManager: Puppeteer.FrameManager;
_frame: Puppeteer.Frame;
_frameManager: FrameManager;
_frame: Frame;
_timeoutSettings: TimeoutSettings;
_documentPromise?: Promise<ElementHandle> = null;
_contextPromise?: Promise<ExecutionContext> = null;
Expand All @@ -43,14 +44,14 @@ export class DOMWorld {
_detached = false;
_waitTasks = new Set<WaitTask>();

constructor(frameManager: Puppeteer.FrameManager, frame: Puppeteer.Frame, timeoutSettings: TimeoutSettings) {
constructor(frameManager: FrameManager, frame: Frame, timeoutSettings: TimeoutSettings) {
this._frameManager = frameManager;
this._frame = frame;
this._timeoutSettings = timeoutSettings;
this._setContext(null);
}

frame(): Puppeteer.Frame {
frame(): Frame {
return this._frame;
}

Expand Down
3 changes: 2 additions & 1 deletion src/ExecutionContext.ts
Expand Up @@ -18,6 +18,7 @@ import {helper, assert} from './helper';
import {createJSHandle, JSHandle, ElementHandle} from './JSHandle';
import {CDPSession} from './Connection';
import {DOMWorld} from './DOMWorld';
import {Frame} from './FrameManager';

export const EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__';
const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
Expand All @@ -33,7 +34,7 @@ export class ExecutionContext {
this._contextId = contextPayload.id;
}

frame(): Puppeteer.Frame | null {
frame(): Frame | null {
return this._world ? this._world.frame() : null;
}

Expand Down