arraybuffer.prototype.transfer

1.0.8 • Public • Published

ArrayBuffer.prototype.transfer Version Badge

github actions coverage License Downloads

npm badge

An ES6 spec-compliant ArrayBuffer.prototype.transfer shim. Invoke its "shim" method to shim ArrayBuffer.prototype.transfer if it is unavailable.

This package implements the es-shim API interface. It works in an ES5-supported environment and complies with the proposed spec.

Most common usage:

var assert = require('assert');
var transfer = require('arraybuffer.prototype.transfer');
var IsDetachedBuffer = require('es-abstract/2023/IsDetachedBuffer');

var ab = new ArrayBuffer('a');

assert.equal(IsDetachedBuffer(ab), false);
transfer(ab);
assert.equal(IsDetachedBuffer(ab), true);

if (!ArrayBuffer.prototype.transfer) {
	transfer.shim();
}

var ab2 = new ArrayBuffer('a');
assert.equal(IsDetachedBuffer(ab2), false);
ab2.transfer();
assert.equal(IsDetachedBuffer(ab2), true);

Tests

Simply clone the repo, npm install, and run npm test

Package Sidebar

Install

npm i arraybuffer.prototype.transfer

Weekly Downloads

18

Version

1.0.8

License

MIT

Unpacked Size

19.8 kB

Total Files

16

Last publish

Collaborators

  • ljharb
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy