feat: Provide code fragments feature (#748)

This commit is contained in:
Anton Wilhelm 2019-01-23 03:54:50 +01:00 committed by cinwell.li
commit 1447c8a40a
4 changed files with 37 additions and 0 deletions

16
docs/_media/example.js Normal file
View file

@ -0,0 +1,16 @@
import fetch from 'fetch'
const URL = 'https://example.com'
const PORT = 8080
/// [demo]
const result = fetch(`${URL}:${PORT}`)
.then(function(response) {
return response.json();
})
.then(function(myJson) {
console.log(JSON.stringify(myJson));
});
/// [demo]
result.then(console.log).catch(console.error)