shim.js 395 B

123456789101112131415161718
  1. 'use strict';
  2. var define = require('define-properties');
  3. var getPolyfill = require('./polyfill');
  4. module.exports = function shimArrayBufferSlice() {
  5. if (typeof ArrayBuffer === 'function') {
  6. var polyfill = getPolyfill();
  7. define(
  8. ArrayBuffer.prototype,
  9. { slice: polyfill },
  10. { slice: function () { return ArrayBuffer.prototype.slice !== polyfill; } }
  11. );
  12. }
  13. return polyfill;
  14. };