1.0.8 • Published 8 years ago

osx-browser-vm v1.0.8

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

os-browser-vm

This library lets you evaluate arbitary JavaScript on the browsers installed on your local OS X machine, through Node.js. It currently supports Safari, Google Chrome, and Google Chrome Canary (Firefox support is apparently not possible). It works thanks to support for JavaScript automation in modern releases of OS X, and is similar to the Node.js vm module.

API

This library exports three properties: safari, chrome, and canary.

{safari|chrome|canary}.run(code, callback)

code is the JavaScript string to be evaluated. The result of the last expression in this string is passed to the callback in the usual Node.js (err, data) signature.

A function can also be passed for code, in which case it is stringified as an IIFE.

Example

import {safari, chrome, canary} from 'osx-browser-vm'

var vms = [safari, chrome, canary]
var code = 'Object.getOwnPropertyNames(window).length'

console.log("Number of properties on window:")

vms.forEach(vm => {
  vm.run(code, (err, count) => {
    console.log("- %s: %s", vm.name, count)
  })
})

// Number of properties on window:
// - Google Chrome Canary: 694
// - Google Chrome: 682
// - Safari: 607
1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago