Skip to content

Commit 3104c59

Browse files
authored
Merge pull request #36 from purescript-contrib/polyfill-delete
Delete the TypedArray polyfill
2 parents 20f4de1 + 3e8cb28 commit 3104c59

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Unreleased
6+
7+
@jamesdbrock Delete the `TypedArray` polyfill which was preventing this
8+
library from working with `purs bundle` v0.14.4.
9+
https://github.com/purescript-contrib/purescript-arraybuffer/issues/34
10+
511
## v11.0.0
612

713
Jorge Acereda has graciously donated this package to __purescript-contrib__.

Diff for: README.md

+17
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ You can contribute to `arraybuffer` in several ways:
5353

5454
3. If you have written a library, tutorial, guide, or other resource based on this package, please share it on the [PureScript Discourse](https://discourse.purescript.org)! Writing libraries and learning resources are a great way to help this library succeed.
5555

56+
## Usage
57+
58+
### Polyfill
59+
60+
This library relies on runtime implementations of
61+
[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
62+
and
63+
[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)
64+
([Structured Data](https://tc39.es/ecma262/multipage/structured-data.html#sec-structured-data)),
65+
and
66+
[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
67+
([Indexed Collections](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-indexed-collections)).
68+
69+
If you want to be sure that those implemtations are available in your target
70+
runtime environment, you might want to consider using a polyfill such as
71+
[__core-js__ Typed Arrays](https://github.com/zloirock/core-js#ecmascript-typed-arrays).
72+
5673
## Related packages
5774

5875
These are some other packages which provide more `ArrayBuffer` features.

Diff for: src/Data/ArrayBuffer/Typed.js

-19
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
11
"use strict";
22

3-
4-
5-
// Lightweight polyfill for ie - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#Methods_Polyfill
6-
function polyFill () {
7-
var typedArrayTypes =
8-
[ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array
9-
, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array
10-
];
11-
12-
for (var k in typedArrayTypes) {
13-
for (var v in Array.prototype) {
14-
if (Array.prototype.hasOwnProperty(v) && !typedArrayTypes[k].prototype.hasOwnProperty(v))
15-
typedArrayTypes[k].prototype[v] = Array.prototype[v];
16-
}
17-
}
18-
};
19-
20-
polyFill();
21-
223
// module Data.ArrayBuffer.Typed
234

245
exports.buffer = function buffer (v) {

0 commit comments

Comments
 (0)