type some of ExecutionContextDelegate

This commit is contained in:
Joel Einbinder 2019-12-06 00:25:29 +00:00
parent dcf92e4d2f
commit 18ddc1bd3f
4 changed files with 4 additions and 4 deletions

View file

@ -149,7 +149,7 @@ export class ExecutionContextDelegate implements js.ExecutionContextDelegate {
await releaseObject(this._client, toRemoteObject(handle)); await releaseObject(this._client, toRemoteObject(handle));
} }
async handleJSONValue(handle: js.JSHandle): Promise<any> { async handleJSONValue<T>(handle: js.JSHandle<T>): Promise<T> {
const remoteObject = toRemoteObject(handle); const remoteObject = toRemoteObject(handle);
if (remoteObject.objectId) { if (remoteObject.objectId) {
const response = await this._client.send('Runtime.callFunctionOn', { const response = await this._client.send('Runtime.callFunctionOn', {

View file

@ -134,7 +134,7 @@ export class ExecutionContextDelegate implements js.ExecutionContextDelegate {
}); });
} }
async handleJSONValue(handle: js.JSHandle): Promise<any> { async handleJSONValue<T>(handle: js.JSHandle<T>): Promise<T> {
const payload = handle._remoteObject; const payload = handle._remoteObject;
if (!payload.objectId) if (!payload.objectId)
return deserializeValue(payload); return deserializeValue(payload);

View file

@ -10,7 +10,7 @@ export interface ExecutionContextDelegate {
getProperties(handle: JSHandle): Promise<Map<string, JSHandle>>; getProperties(handle: JSHandle): Promise<Map<string, JSHandle>>;
releaseHandle(handle: JSHandle): Promise<void>; releaseHandle(handle: JSHandle): Promise<void>;
handleToString(handle: JSHandle, includeType: boolean): string; handleToString(handle: JSHandle, includeType: boolean): string;
handleJSONValue(handle: JSHandle): Promise<any>; handleJSONValue<T>(handle: JSHandle<T>): Promise<T>;
} }
export class ExecutionContext { export class ExecutionContext {

View file

@ -289,7 +289,7 @@ export class ExecutionContextDelegate implements js.ExecutionContextDelegate {
await releaseObject(this._session, toRemoteObject(handle)); await releaseObject(this._session, toRemoteObject(handle));
} }
async handleJSONValue(handle: js.JSHandle): Promise<any> { async handleJSONValue<T>(handle: js.JSHandle<T>): Promise<T> {
const remoteObject = toRemoteObject(handle); const remoteObject = toRemoteObject(handle);
if (remoteObject.objectId) { if (remoteObject.objectId) {
const response = await this._session.send('Runtime.callFunctionOn', { const response = await this._session.send('Runtime.callFunctionOn', {