Asynchronously load gists.
npm install async-gistGist embeds like this one:
``html`
Use document.write() which is totally uncool if you are doing stuff like history.pushState().
This plugin provides an alternative way to embed gists.
In your JavaScript you’ll want:
`javascript`
$('[data-gist]').gist()
Which maps to the corresponding markup:
`html`
Or if you want to embed a specific file from a gist:
`html`
This library can be install with npm, bower, or just by downloading the zip. It is written in the UMD pattern to support AMD, CommonJS, and global usage.
npm
npm install async-gist --save
bower
bower install async-gist --save
A few options can be passed, for example, here we make the timeout 2 seconds:
`javascript`
$('[data-gist]').gist({
timeout: 2000
})
Default: 1000
Description: How long to wait for the jsonp.
Default: onAjaxSuccess
Description: It is best to leave this alone and let the internal function do the need. It’ll load the needed stylesheet and gist content.
Default: onAjaxError`
Description: It is also best to leave this alone. It’ll display a link to the gist on failure to load.