Skip to content

Commit

Permalink
Merge pull request #160 from dijs/chaining
Browse files Browse the repository at this point in the history
Chaining
  • Loading branch information
dijs authored Aug 12, 2021
2 parents 66c7bf4 + 0f286f2 commit a91e4ec
Show file tree
Hide file tree
Showing 52 changed files with 25,877 additions and 41 deletions.
71 changes: 34 additions & 37 deletions .jsdoc.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc"]
},
"source": {
"include": [
"src/coordinates.js",
"src/page.js",
"src/util.js",
"src/wiki.js",
"package.json",
"README.md"
],
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": [
"plugins/markdown"
],
"templates": {
"cleverLinks": false,
"monospaceLinks": true,
"default": {
"staticFiles": {
"include": [
"./static"
]
}
}
},
"opts": {
"destination": "./docs",
"encoding": "utf8",
"private": true,
"recurse": true,
"template": "./node_modules/minami"
}
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc"]
},
"source": {
"include": [
"src/coordinates.js",
"src/page.js",
"src/util.js",
"src/chain.js",
"src/wiki.js",
"package.json",
"README.md"
],
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": false,
"monospaceLinks": true,
"default": {
"staticFiles": {
"include": ["./static"]
}
}
},
"opts": {
"destination": "./docs",
"encoding": "utf8",
"private": true,
"recurse": true,
"template": "./node_modules/minami"
}
}
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,35 @@ wiki({
}).search('Winterfell');
```

## Chain data requests together for more efficient applications

Query a specific page:

```js
wiki()
.page('albert einstein')
.then(page =>
page
.chain()
.summary()
.image()
.links()
.request()
);
```

Or query many pages at once:

```js
wiki()
.chain()
.geosearch(52.52437, 13.41053)
.summary()
.image()
.coordinates()
.request();
```

## Parsing Wiki Infobox Data

The code Wikipedia uses for infobox data is strange and complex. So I have split the parsing code into another library. You can find it [here](https://github.com/dijs/infobox-parser).
Expand Down
Loading

0 comments on commit a91e4ec

Please sign in to comment.