browser-module-sandbox
uses browserify-cdn to run node code in an iframe
Last updated a year ago by dmitri .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install browser-module-sandbox 
SYNC missed versions from official npm registry.

browser-module-sandbox

uses browserify-cdn to run node code in an iframe

requires a hosted browserify-cdn

npm install browser-module-sandbox

usage

var Sandbox = require('browser-module-sandbox')

initialize

sandbox(options)

var sandbox = Sandbox({
  name: iframe name attribute,
  cdn: 'http://localhost:8000', // browserify-cdn API endpoint, defaults to the current browser domain root,
  container: dom element where the iframe should be appended,
  iframeHead: string that gets prepended to the `<head>` of the output iframe,
  iframeBody: string that gets prepended to the `<body>` of the output iframe,
  iframeStyle: string for css, gets appended to end of iframeHead,
  iframeSandbox: array of capability flag strings,
  iframe: iframe instance, default creates a new one inside container
})

bundling

sandbox.bundle(entry, preferredVersions)

sandbox.bundle('console.log(require("underscore"))', {'underscore': '1.3.3'})

preferredVersions is optional, version will otherwise default to latest

events

sandbox.on('modules', function(modules) {})

modules is the array of modules that gets parsed out of the bundle entry by the detective module

sandbox.on('bundleStart', function() {})

emits when the bundle request begins

sandbox.on('bundleContent', function(body) {})

emits when the iframe content is being built, body is a string made up of all the bundles (NOTE: it doesn't contain entry)

sandbox.on('bundleEnd', function(html) {})

emits when the bundle request finishes. html is an object that has the iframe header contents and the full bundle body (made of up all the bundles + the entry in an executable form)

license

BSD

Current Tags

  • 2.0.1                                ...           latest (a year ago)

30 Versions

  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.4.5                                ...           3 years ago
  • 1.4.4                                ...           4 years ago
  • 1.4.3                                ...           4 years ago
  • 1.4.2                                ...           4 years ago
  • 1.4.1                                ...           4 years ago
  • 1.4.0                                ...           5 years ago
  • 1.3.10                                ...           5 years ago
  • 1.3.9                                ...           5 years ago
  • 1.3.7                                ...           5 years ago
  • 1.3.6                                ...           6 years ago
  • 1.3.5                                ...           6 years ago
  • 1.3.4                                ...           6 years ago
  • 1.3.3                                ...           6 years ago
  • 1.3.2                                ...           6 years ago
  • 1.3.1                                ...           6 years ago
  • 1.3.0                                ...           6 years ago
  • 1.2.1                                ...           6 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.9                                ...           7 years ago
  • 0.0.7                                ...           7 years ago
  • 0.0.6                                ...           7 years ago
  • 0.0.5                                ...           7 years ago
  • 0.0.4                                ...           7 years ago
  • 0.0.3                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 60
Last Day 0
Last Week 60
Last Month 32
Dependencies (5)
Dev Dependencies (6)

Copyright 2014 - 2016 © taobao.org |