Package Exports
- system.global
- system.global/implementation
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 (system.global) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
An ECMAScript spec-compliant polyfill/shim for global
. Invoke its "shim" method to shim global
if it is unavailable.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec proposal.
Most common usage:
var global = require('system.global')(); // returns native method if compliant
/* or */
var global = require('system.global/polyfill')(); // returns native method if compliant
Example
var assert = require('assert');
// the below function is not CSP-compliant, but reliably gets the
// global object in sloppy mode in every engine.
var getGlobal = Function('return this');
assert.equal(global, getGlobal());
/* when `global` is not present */
var shimmedGlobal = require('system.global').shim();
/* or */
var shimmedGlobal = require('system.global/shim')();
assert.equal(shimmedGlobal, global);
assert.equal(shimmedGlobal, getGlobal());
/* when `global` is present */
var shimmedGlobal = require('system.global').shim();
assert.equal(shimmedGlobal, global);
assert.equal(shimmedGlobal, getGlobal());
Tests
Simply clone the repo, npm install
, and run npm test