{ "name": "vm-browserify", "version": "0.0.1", "description": "vm module for the browser", "main": "index.js", "directories": { "example": "example", "test": "test" }, "repository": { "type": "git", "url": "http://github.com/substack/vm-browserify.git" }, "keywords": [ "vm", "browser", "eval" ], "devDependencies": { "tap": "~0.2.1", "browserify": "1.9.x" }, "author": { "name": "James Halliday", "email": "mail@substack.net", "url": "http://substack.net" }, "scripts": { "test": "tap test/*.js" }, "license": "MIT/X11", "engine": { "node": ">=0.4.0" }, "readme": "vm-browserify\n=============\n\nEmulate node's vm module for the browser.\n\nexample\n=======\n\nJust write some client-side javascript:\n\n``` js\nvar vm = require('vm');\n\n$(function () {\n var res = vm.runInNewContext('a + 5', { a : 100 });\n $('#res').text(res);\n});\n```\n\ncompile it with [browserify](http://github.com/substack/node-browserify):\n\n```\nbrowserify entry.js -o bundle.js\n```\n\nthen whip up some html:\n\n``` html\n\n \n \n \n \n \n result = \n \n\n```\n\nand when you load the page you should see:\n\n```\nresult = 105\n```\n\nmethods\n=======\n\nvm.runInNewContext(code, context={})\n------------------------------------\n\nEvaluate some `code` in a new iframe with a `context`.\n\nContexts are like wrapping your code in a `with()` except slightly less terrible\nbecause the code is sandboxed into a new iframe.\n\nbrowser compatability\n=====================\n\nAll modern browsers are supported.\n\nIf you have a [browserling](http://browserling.com) account,\nfrom the testling/ directory just do:\n\n```\n$ ./test.sh substack@gmail.com\nEnter host password for user 'substack@gmail.com':\nchrome/17.0:\n vmRunInNewContext ................................. 5/5\n\niexplore/9.0:\n vmRunInNewContext ................................. 5/5\n\nfirefox/10.0:\n vmRunInNewContext ................................. 5/5\n\nsafari/5.1:\n vmRunInNewContext ................................. 5/5\n\nopera/11.6:\n vmRunInNewContext ................................. 5/5\n\ntotal ............................................... 25/25\n```\n\nIn IE8 and IE7, running `vm.runInNewContext()` more than once can cause the\nbrowsers to hang for some reason. Otherwise they work too.\n\ninstall\n=======\n\nThis module is depended upon by browserify, so you should just be able to\n`require('vm')` and it will just work. However if you want to use this module\ndirectly you can install it with [npm](http://npmjs.org):\n\n```\nnpm install vm-browserify\n```\n\nlicense\n=======\n\nMIT/X11\n", "readmeFilename": "README.markdown", "_id": "vm-browserify@0.0.1", "_from": "vm-browserify@0.0.x" }