taki

Install
npm i taki
Usage
const taki = require('taki')
taki({ url: 'https://sao.js.org', wait: 1000 })
.then(html => {
console.log(html)
})
Multiplate URLs
taki([
{ url: 'https://sao.js.org' },
{ url: 'https://sao.js.org/#/create' }
]).then(result => {
})
Manually take snapshot
By default taki will take a snapshot of the URL in a specific timeout (50 by default) when all resource are loaded, if you have control of the website's source code, you can disable that and manually call window.snapshot
:
taki({
url: 'http://my-web.com',
manually: true
})
And in your website's source code:
fetchSomeData().then(data => {
this.setState({ data }, () => {
+ window.snapshot && window.snapshot()
})
})
Alternatively, choose your own method to invoke when your app is ready to return HTML:
taki({
url: 'http://my-web.com',
manually: 'iamready'
})
Then call window.iamready()
instead of window.snapshot()
in your app.
Wait
Wait for specific timeout or a CSS selector to appera in dom.
taki({
url,
wait: 3000,
wait: '.comments'
})
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
taki © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
egoist.moe · GitHub @egoist · Twitter @_egoistlily