Package Exports
- osx-browser-vm
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (osx-browser-vm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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