mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Remove promise jsdoc (#641)
This patch removes unnecessary "promise" return types in jsdoc for async functions.
This commit is contained in:
parent
62ececb1c7
commit
42fa3af659
@ -117,9 +117,6 @@ class Connection extends EventEmitter {
|
|||||||
this._sessions.clear();
|
this._sessions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
dispose() {
|
dispose() {
|
||||||
this._onClose();
|
this._onClose();
|
||||||
this._ws.close();
|
this._ws.close();
|
||||||
@ -203,9 +200,6 @@ class Session extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
async dispose() {
|
async dispose() {
|
||||||
await this._connection.send('Target.closeTarget', {targetId: this._targetId});
|
await this._connection.send('Target.closeTarget', {targetId: this._targetId});
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ class Dialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string=} promptText
|
* @param {string=} promptText
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async accept(promptText) {
|
async accept(promptText) {
|
||||||
console.assert(!this._handled, 'Cannot accept dialog which is already handled!');
|
console.assert(!this._handled, 'Cannot accept dialog which is already handled!');
|
||||||
@ -58,9 +57,6 @@ class Dialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
async dismiss() {
|
async dismiss() {
|
||||||
console.assert(!this._handled, 'Cannot dismiss dialog which is already handled!');
|
console.assert(!this._handled, 'Cannot dismiss dialog which is already handled!');
|
||||||
this._handled = true;
|
this._handled = true;
|
||||||
|
@ -29,9 +29,6 @@ class ElementHandle {
|
|||||||
this._disposed = false;
|
this._disposed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
async dispose() {
|
async dispose() {
|
||||||
if (this._disposed)
|
if (this._disposed)
|
||||||
return;
|
return;
|
||||||
@ -77,9 +74,6 @@ class ElementHandle {
|
|||||||
return center;
|
return center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
async hover() {
|
async hover() {
|
||||||
const {x, y} = await this._visibleCenter();
|
const {x, y} = await this._visibleCenter();
|
||||||
await this._mouse.move(x, y);
|
await this._mouse.move(x, y);
|
||||||
@ -87,7 +81,6 @@ class ElementHandle {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Object=} options
|
* @param {!Object=} options
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async click(options) {
|
async click(options) {
|
||||||
const {x, y} = await this._visibleCenter();
|
const {x, y} = await this._visibleCenter();
|
||||||
|
@ -284,7 +284,7 @@ class Frame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} filePath
|
* @param {string} filePath
|
||||||
* @return {!Promise}
|
* @return {!Promise<*>}
|
||||||
*/
|
*/
|
||||||
async injectFile(filePath) {
|
async injectFile(filePath) {
|
||||||
let contents = await new Promise((resolve, reject) => {
|
let contents = await new Promise((resolve, reject) => {
|
||||||
@ -299,7 +299,6 @@ class Frame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async addScriptTag(url) {
|
async addScriptTag(url) {
|
||||||
return this.evaluate(addScriptTag, url);
|
return this.evaluate(addScriptTag, url);
|
||||||
|
@ -29,7 +29,6 @@ class Keyboard {
|
|||||||
/**
|
/**
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @param {{text: (string|undefined)}} options
|
* @param {{text: (string|undefined)}} options
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async down(key, options = {}) {
|
async down(key, options = {}) {
|
||||||
const text = options.text;
|
const text = options.text;
|
||||||
@ -65,7 +64,6 @@ class Keyboard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async up(key) {
|
async up(key) {
|
||||||
this._modifiers &= ~this._modifierBit(key);
|
this._modifiers &= ~this._modifierBit(key);
|
||||||
@ -80,7 +78,6 @@ class Keyboard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} char
|
* @param {string} char
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async sendCharacter(char) {
|
async sendCharacter(char) {
|
||||||
await this._client.send('Input.dispatchKeyEvent', {
|
await this._client.send('Input.dispatchKeyEvent', {
|
||||||
|
@ -47,7 +47,6 @@ class NetworkManager extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Object<string, string>} extraHTTPHeaders
|
* @param {!Object<string, string>} extraHTTPHeaders
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async setExtraHTTPHeaders(extraHTTPHeaders) {
|
async setExtraHTTPHeaders(extraHTTPHeaders) {
|
||||||
this._extraHTTPHeaders = {};
|
this._extraHTTPHeaders = {};
|
||||||
@ -65,7 +64,6 @@ class NetworkManager extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} userAgent
|
* @param {string} userAgent
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async setUserAgent(userAgent) {
|
async setUserAgent(userAgent) {
|
||||||
return this._client.send('Network.setUserAgentOverride', { userAgent });
|
return this._client.send('Network.setUserAgentOverride', { userAgent });
|
||||||
@ -73,7 +71,6 @@ class NetworkManager extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} value
|
* @param {boolean} value
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async setRequestInterceptionEnabled(value) {
|
async setRequestInterceptionEnabled(value) {
|
||||||
await this._client.send('Network.setRequestInterceptionEnabled', {enabled: !!value});
|
await this._client.send('Network.setRequestInterceptionEnabled', {enabled: !!value});
|
||||||
|
17
lib/Page.js
17
lib/Page.js
@ -205,7 +205,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async addScriptTag(url) {
|
async addScriptTag(url) {
|
||||||
return this.mainFrame().addScriptTag(url);
|
return this.mainFrame().addScriptTag(url);
|
||||||
@ -213,7 +212,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} filePath
|
* @param {string} filePath
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async injectFile(filePath) {
|
async injectFile(filePath) {
|
||||||
return this.mainFrame().injectFile(filePath);
|
return this.mainFrame().injectFile(filePath);
|
||||||
@ -252,7 +250,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Object<string, string>} headers
|
* @param {!Object<string, string>} headers
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async setExtraHTTPHeaders(headers) {
|
async setExtraHTTPHeaders(headers) {
|
||||||
return this._networkManager.setExtraHTTPHeaders(headers);
|
return this._networkManager.setExtraHTTPHeaders(headers);
|
||||||
@ -260,7 +257,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} userAgent
|
* @param {string} userAgent
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async setUserAgent(userAgent) {
|
async setUserAgent(userAgent) {
|
||||||
return this._networkManager.setUserAgent(userAgent);
|
return this._networkManager.setUserAgent(userAgent);
|
||||||
@ -333,7 +329,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} html
|
* @param {string} html
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async setContent(html) {
|
async setContent(html) {
|
||||||
await this.evaluate(html => {
|
await this.evaluate(html => {
|
||||||
@ -425,7 +420,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Object} options
|
* @param {!Object} options
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async emulate(options) {
|
async emulate(options) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
@ -443,7 +437,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?string} mediaType
|
* @param {?string} mediaType
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async emulateMedia(mediaType) {
|
async emulateMedia(mediaType) {
|
||||||
console.assert(mediaType === 'screen' || mediaType === 'print' || mediaType === null, 'Unsupported media type: ' + mediaType);
|
console.assert(mediaType === 'screen' || mediaType === 'print' || mediaType === null, 'Unsupported media type: ' + mediaType);
|
||||||
@ -452,7 +445,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Page.Viewport} viewport
|
* @param {!Page.Viewport} viewport
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async setViewport(viewport) {
|
async setViewport(viewport) {
|
||||||
const needsReload = await this._emulationManager.emulateViewport(this._client, viewport);
|
const needsReload = await this._emulationManager.emulateViewport(this._client, viewport);
|
||||||
@ -480,7 +472,6 @@ class Page extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* @param {function()|string} pageFunction
|
* @param {function()|string} pageFunction
|
||||||
* @param {!Array<*>} args
|
* @param {!Array<*>} args
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async evaluateOnNewDocument(pageFunction, ...args) {
|
async evaluateOnNewDocument(pageFunction, ...args) {
|
||||||
const source = helper.evaluationString(pageFunction, ...args);
|
const source = helper.evaluationString(pageFunction, ...args);
|
||||||
@ -627,9 +618,6 @@ class Page extends EventEmitter {
|
|||||||
return this.mainFrame().title();
|
return this.mainFrame().title();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
async close() {
|
async close() {
|
||||||
await this._client.dispose();
|
await this._client.dispose();
|
||||||
}
|
}
|
||||||
@ -644,7 +632,6 @@ class Page extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* @param {string} selector
|
* @param {string} selector
|
||||||
* @param {!Object} options
|
* @param {!Object} options
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async click(selector, options) {
|
async click(selector, options) {
|
||||||
const handle = await this.$(selector);
|
const handle = await this.$(selector);
|
||||||
@ -655,7 +642,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} selector
|
* @param {string} selector
|
||||||
* @param {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async hover(selector) {
|
async hover(selector) {
|
||||||
const handle = await this.$(selector);
|
const handle = await this.$(selector);
|
||||||
@ -666,7 +652,6 @@ class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} selector
|
* @param {string} selector
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async focus(selector) {
|
async focus(selector) {
|
||||||
const handle = await this.$(selector);
|
const handle = await this.$(selector);
|
||||||
@ -678,7 +663,6 @@ class Page extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string} text
|
||||||
* @param {{delay: (number|undefined)}=} options
|
* @param {{delay: (number|undefined)}=} options
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async type(text, options) {
|
async type(text, options) {
|
||||||
let delay = 0;
|
let delay = 0;
|
||||||
@ -696,7 +680,6 @@ class Page extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string} text
|
||||||
* @param {!Object=} options
|
* @param {!Object=} options
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async press(key, options) {
|
async press(key, options) {
|
||||||
this._keyboard.down(key, options);
|
this._keyboard.down(key, options);
|
||||||
|
@ -28,7 +28,6 @@ class Tracing {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Object} options
|
* @param {!Object} options
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async start(options) {
|
async start(options) {
|
||||||
console.assert(!this._recording, 'Cannot start recording trace while already recording trace.');
|
console.assert(!this._recording, 'Cannot start recording trace while already recording trace.');
|
||||||
@ -52,9 +51,6 @@ class Tracing {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
async stop() {
|
async stop() {
|
||||||
let fulfill;
|
let fulfill;
|
||||||
const contentPromise = new Promise(x => fulfill = x);
|
const contentPromise = new Promise(x => fulfill = x);
|
||||||
@ -69,7 +65,6 @@ class Tracing {
|
|||||||
/**
|
/**
|
||||||
* @param {string} handle
|
* @param {string} handle
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async _readStream(handle, path) {
|
async _readStream(handle, path) {
|
||||||
let eof = false;
|
let eof = false;
|
||||||
|
@ -90,7 +90,6 @@ class Helper {
|
|||||||
/**
|
/**
|
||||||
* @param {!Session} client
|
* @param {!Session} client
|
||||||
* @param {!Object} remoteObject
|
* @param {!Object} remoteObject
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
static async releaseObject(client, remoteObject) {
|
static async releaseObject(client, remoteObject) {
|
||||||
if (!remoteObject.objectId)
|
if (!remoteObject.objectId)
|
||||||
|
@ -19,7 +19,6 @@ const utils = module.exports = {
|
|||||||
* @param {!Page} page
|
* @param {!Page} page
|
||||||
* @param {string} frameId
|
* @param {string} frameId
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
attachFrame: async function(page, frameId, url) {
|
attachFrame: async function(page, frameId, url) {
|
||||||
await page.evaluate(attachFrame, frameId, url);
|
await page.evaluate(attachFrame, frameId, url);
|
||||||
@ -36,7 +35,6 @@ const utils = module.exports = {
|
|||||||
/**
|
/**
|
||||||
* @param {!Page} page
|
* @param {!Page} page
|
||||||
* @param {string} frameId
|
* @param {string} frameId
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
detachFrame: async function(page, frameId) {
|
detachFrame: async function(page, frameId) {
|
||||||
await page.evaluate(detachFrame, frameId);
|
await page.evaluate(detachFrame, frameId);
|
||||||
@ -51,7 +49,6 @@ const utils = module.exports = {
|
|||||||
* @param {!Page} page
|
* @param {!Page} page
|
||||||
* @param {string} frameId
|
* @param {string} frameId
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
navigateFrame: async function(page, frameId, url) {
|
navigateFrame: async function(page, frameId, url) {
|
||||||
await page.evaluate(navigateFrame, frameId, url);
|
await page.evaluate(navigateFrame, frameId, url);
|
||||||
|
@ -88,9 +88,6 @@ class SimpleServer {
|
|||||||
socket.once('close', () => this._sockets.delete(socket));
|
socket.once('close', () => this._sockets.delete(socket));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
async stop() {
|
async stop() {
|
||||||
this.reset();
|
this.reset();
|
||||||
for (const socket of this._sockets)
|
for (const socket of this._sockets)
|
||||||
|
@ -63,9 +63,6 @@ const fromRevision = parseInt(process.argv[2], 10);
|
|||||||
const toRevision = parseInt(process.argv[3], 10);
|
const toRevision = parseInt(process.argv[3], 10);
|
||||||
checkRangeAvailability(fromRevision, toRevision);
|
checkRangeAvailability(fromRevision, toRevision);
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
|
||||||
async function checkOmahaProxyAvailability() {
|
async function checkOmahaProxyAvailability() {
|
||||||
console.log('Fetching revisions from ' + OMAHA_PROXY);
|
console.log('Fetching revisions from ' + OMAHA_PROXY);
|
||||||
const platforms = await loadJSON(OMAHA_PROXY);
|
const platforms = await loadJSON(OMAHA_PROXY);
|
||||||
@ -93,7 +90,6 @@ async function checkOmahaProxyAvailability() {
|
|||||||
/**
|
/**
|
||||||
* @param {number} fromRevision
|
* @param {number} fromRevision
|
||||||
* @param {number} toRevision
|
* @param {number} toRevision
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async function checkRangeAvailability(fromRevision, toRevision) {
|
async function checkRangeAvailability(fromRevision, toRevision) {
|
||||||
const table = new Table([10, 7, 7, 7, 7]);
|
const table = new Table([10, 7, 7, 7, 7]);
|
||||||
@ -107,7 +103,6 @@ async function checkRangeAvailability(fromRevision, toRevision) {
|
|||||||
* @param {!Table} table
|
* @param {!Table} table
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
* @param {number} revision
|
* @param {number} revision
|
||||||
* @return {!Promise}
|
|
||||||
*/
|
*/
|
||||||
async function checkAndDrawRevisionAvailability(table, name, revision) {
|
async function checkAndDrawRevisionAvailability(table, name, revision) {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user