https://github.com/dogma-io/vmdom
Lightweight browser implementation for Node's VM.
https://github.com/dogma-io/vmdom
api browser document node node-vm nodejs server-side-rendering virtual-machine vm window
Last synced: 11 days ago
JSON representation
Lightweight browser implementation for Node's VM.
- Host: GitHub
- URL: https://github.com/dogma-io/vmdom
- Owner: dogma-io
- Created: 2017-12-18T14:42:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-03T02:20:15.000Z (over 6 years ago)
- Last Synced: 2024-04-30T02:21:31.607Z (about 1 year ago)
- Topics: api, browser, document, node, node-vm, nodejs, server-side-rendering, virtual-machine, vm, window
- Language: JavaScript
- Size: 188 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# vmdom [![NPM][npm-img]][npm-url] [![Coverage][cov-img]][cov-url]
Lightweight browser implementation for Node's VM.
## Installation
**npm**
```bash
npm install vmdom
```**yarn**
```bash
yarn add vmdom
```## Usage
```js
import {Browser} from 'vmdom'const browser = new Browser()
const {eval, window} = browser// Execute arbitrary JavaScript using eval
eval("window.foo = 'bar'")console.log(window.foo) // logs "bar" to console
// When you are done make sure all timers, event handlers, etc are cleaned up
Browser.destroy(browser)
```[cov-img]: https://img.shields.io/codecov/c/github/dogma-io/vmdom.svg "Code Coverage"
[cov-url]: https://codecov.io/gh/dogma-io/vmdom[npm-img]: https://img.shields.io/npm/v/vmdom.svg "NPM Version"
[npm-url]: https://www.npmjs.com/package/vmdom