Coder Social home page Coder Social logo

shama / browser-module-sandbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from max-mapper/browser-module-sandbox

0.0 3.0 1.0 403 KB

browser editor for code that gets 'compiled' on the server with node and run on the client

JavaScript 100.00%

browser-module-sandbox's Introduction

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({
  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,
  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('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

browser-module-sandbox's People

Contributors

max-mapper avatar

Watchers

Kyle Robinson Young avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.