commonjs-editor
DEPRECATED moved to https://github.com/lachrist/sandbox-editor
Edit and execute top-level files of CommonJS modules in browsers. Usage here, live demo here. CommonjsEditor is powered by browserify and c9.ace.io. Node-inspired variables accessible inside the editor:
-
global
: the global object. -
require
: for importing CommonJS modules. -
module
: for redefining the entire export. -
exports
: for exporting a particular field. -
__filename
: relative tooptions.basedir
. -
__dirname
: relative tooptions.basedir
. -
process
: if defined:process.argv[1] = __filename
. -
Buffer
: only available whenBuffer
orrequire("buffer")
is present.
Playground
playground.path :: string
playground :: commonjs-editor.Playground
playground.modules :: [string]
playground :: commonjs-editor.Playground
playground.initial :: string
playground :: commonjs-editor.Playground
playground.require :: string
playground :: commonjs-editor.Playground
require("commonjs-editor/playground")(path, options, callback)
path :: string
options :: browserify.Options
-
callback(error, playground)
error :: Error
playground :: commonjs-editor.Playground
editor = require("commonjs-editor")(container, playground)
container :: dom.Element
playground :: commonjs-editor.Playground
-
editor :: c9.ace.io.Editor
bundle = getBundle()