formdata-polyfill

WebJar for formdata-polyfill

Лицензия

Лицензия

MIT
Категории

Категории

Данные ORM
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

formdata-polyfill
Последняя версия

Последняя версия

3.0.13
Дата

Дата

Тип

Тип

jar
Описание

Описание

formdata-polyfill
WebJar for formdata-polyfill
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/jimmywarting/FormData

Скачать formdata-polyfill

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/formdata-polyfill/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>formdata-polyfill</artifactId>
    <version>3.0.13</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/formdata-polyfill/
implementation 'org.webjars.npm:formdata-polyfill:3.0.13'
// https://jarcasting.com/artifacts/org.webjars.npm/formdata-polyfill/
implementation ("org.webjars.npm:formdata-polyfill:3.0.13")
'org.webjars.npm:formdata-polyfill:jar:3.0.13'
<dependency org="org.webjars.npm" name="formdata-polyfill" rev="3.0.13">
  <artifact name="formdata-polyfill" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='formdata-polyfill', version='3.0.13')
)
libraryDependencies += "org.webjars.npm" % "formdata-polyfill" % "3.0.13"
[org.webjars.npm/formdata-polyfill "3.0.13"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

FormData

Greenkeeper badge

Build Status

npm version

JavaScript Style Guide

npm install formdata-polyfill

A FormData polyfill

This polyfill conditionally replaces the native implementation rather then fixing the missing functions, since otherwise there is no way to get or delete existing values in the FormData object. Therefore this also patches XMLHttpRequest.prototype.send and fetch to send the FormData as a blob, and navigator.sendBeacon to send native FormData.

I was unable to patch the Response/Request constructor so if you are constructing them with FormData you need to call fd._blob() manually.

new Request(url, {
  method: 'post',
  body: fd._blob ? fd._blob() : fd
})

Dependencies

If you need to support IE <= 9 then I recommend you to include eligrey's blob.js

Updating from 2.x to 3.x

Previously you had to import the polyfill and use that, since it didn't replace the global (existing) FormData implementation. But now it transparently calls _blob() for you when you are sending something with fetch or XHR, by way of monkey-patching the XMLHttpRequest.prototype.send and fetch functions.

So you maybe had something like this:

var FormData = require('formdata-polyfill')
var fd = new FormData(form)
xhr.send(fd._blob())

There is no longer anything exported from the module (though you of course still need to import it to install the polyfill), so you can now use the FormData object as normal:

require('formdata-polyfill')
var fd = new FormData(form)
xhr.send(fd)

Native Browser compatibility (as of 2020-01-13)

Based on this you can decide for yourself if you need this polyfill.

skarmavbild 2020-01-13 kl 20 16 36

This polyfill normalizes support for the FormData API:

  • append with filename
  • delete(), get(), getAll(), has(), set()
  • entries(), keys(), values(), and support for for...of
  • Available in web workers (just include the polyfill)

Версии библиотеки

Версия
3.0.13
3.0.9