docs: split nodejs and python links (#4942)

This commit is contained in:
Pavel Feldman 2021-01-07 23:37:53 -08:00 committed by GitHub
parent 2e05feac25
commit 15c0a29526
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 29 deletions

View file

@ -399,6 +399,7 @@ await browserContext.setGeolocation({latitude: 59.95, longitude: 30.31667});
pages to read its geolocation.
### param: BrowserContext.setGeolocation.geolocation
* langs: js
- `geolocation` <[null]|[Object]>
- `latitude` <[float]> Latitude between -90 and 90. **required**
- `longitude` <[float]> Longitude between -180 and 180. **required**

View file

@ -56,3 +56,26 @@ Script to be evaluated in all pages in the browser context. Optional.
### param: Page.selectOption.index = %%-python-select-options-index-%%
### param: Page.selectOption.value = %%-python-select-options-value-%%
### param: Page.selectOption.label = %%-python-select-options-label-%%
## async method: BrowserContext.resetGeolocation
* langs: python
Emulates position unavailable state.
### param: BrowserContext.setGeolocation.latitude
* langs: python
- `latitude` <[float]>
Latitude between -90 and 90. **required**
### param: BrowserContext.setGeolocation.longitude
* langs: python
- `longitude` <[float]>
Longitude between -180 and 180. **required**
### param: BrowserContext.setGeolocation.accuracy
* langs: python
- `accuracy` <[float]>
Non-negative accuracy value. Defaults to `0`. Optional.

15
docs/src/links-js.md Normal file
View file

@ -0,0 +1,15 @@
[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"
[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"
[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"
[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"
[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"
[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"
[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"
[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"
[URL]: https://nodejs.org/api/url.html "URL"

11
docs/src/links-python.md Normal file
View file

@ -0,0 +1,11 @@
[Any]: https://docs.python.org/3/library/typing.html#typing.Any "Any"
[bool]: https://docs.python.org/3/library/stdtypes.html "bool"
[Callable]: https://docs.python.org/3/library/typing.html#typing.Callable "Callable"
[Dict]: https://docs.python.org/3/library/typing.html#typing.Dict "Dict"
[float]: https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex "float"
[int]: https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex "int"
[List]: https://docs.python.org/3/library/typing.html#typing.List "List"
[NoneType]: https://docs.python.org/3/library/constants.html#None "None"
[pathlib.Path]: https://realpython.com/python-pathlib/ "pathlib.Path"
[str]: https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str "str"
[Union]: https://docs.python.org/3/library/typing.html#typing.Union "Union"

View file

@ -1,25 +1,9 @@
[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"
[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"
[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"
[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"
[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"
[Evaluation Argument]: ./core-concepts.md#evaluationargument "Evaluation Argument"
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"
[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"
[URL]: https://nodejs.org/api/url.html "URL"
[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"
[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"
[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"
[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"
[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"
[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"
[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"
[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"
[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"
[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"
[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"
[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"

View file

@ -86,19 +86,16 @@ class ApiParser {
if (!returnType)
returnType = new Documentation.Type('void');
if (match[1] === 'async method') {
const templates = [ returnType ];
returnType = new Documentation.Type('Promise');
returnType.templates = templates;
}
let member;
if (match[1] === 'event')
member = Documentation.Member.createEvent(extractLangs(spec), name, returnType, extractComments(spec));
if (match[1] === 'property')
member = Documentation.Member.createProperty(extractLangs(spec), name, returnType, extractComments(spec));
if (match[1] === 'method' || match[1] === 'async method')
if (match[1] === 'method' || match[1] === 'async method') {
member = Documentation.Member.createMethod(extractLangs(spec), name, [], returnType, extractComments(spec));
if (match[1] === 'async method')
member.async = true;
}
const clazz = this.classes.get(match[2]);
clazz.membersArray.push(member);
}

View file

@ -285,7 +285,8 @@ Documentation.Member = class {
if (node.text && node.text.includes('**DEPRECATED**'))
this.deprecated = true;
});
}
};
this.async = false;
}
index() {
@ -312,7 +313,9 @@ Documentation.Member = class {
}
clone() {
return new Documentation.Member(this.kind, this.langs, this.name, this.type, this.argsArray, this.spec, this.required);
const result = new Documentation.Member(this.kind, this.langs, this.name, this.type, this.argsArray, this.spec, this.required);
result.async = this.async;
return result;
}
/**

View file

@ -229,7 +229,9 @@ function classBody(classDesc) {
}
const jsdoc = memberJSDOC(member, ' ');
const args = argsFromMember(member, ' ', classDesc.name);
const type = stringifyComplexType(member.type, ' ', classDesc.name, member.name);
let type = stringifyComplexType(member.type, ' ', classDesc.name, member.name);
if (member.async)
type = `Promise<${type}>`;
// do this late, because we still want object definitions for overridden types
if (!hasOwnMethod(classDesc, member.name))
return '';