Skip to content

sethvincent/interactive-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

interactive-sandbox

Create editable, interactive code examples for the browser that bundle dependencies from npm.

Install

npm install --save interactive-sandbox

Usage

Simple example:

var createSandbox = require('interactive-sandbox')

var code = `var html = require('yo-yo')
var request = require('xhr')

request('http://boundaries.seattle.io/boundaries', function (err, res, body) {
  console.log(body)
  var content = html\`<p>\${body}</p>\`
  document.body.appendChild(content)
})
`

var sandbox = createSandbox(code, {
  onChange: function (changedCode) {
    console.log('changedCode', changedCode)
  }
})

document.body.appendChild(sandbox.render())

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published