Skip to content

Releases: github/remote-form

v0.0.10

24 Sep 17:03
7dc0904
Compare
Choose a tag to compare

ErrorWithResponse has been added as an exported type to the TypeScript definition file.

v0.0.9...v0.0.10

v0.0.9

06 Sep 12:01
d11f7a2
Compare
Choose a tag to compare
  • Merge pull request #11 from github/allow-promises-in-handler-return-value 5cc3e86
  • Merge pull request #12 from github/dependabot/npm_and_yarn/eslint-utils-1.4.2 0f694ca
  • Bump eslint-utils from 1.3.1 to 1.4.2 86efa42
  • add Promise<void> to handlers return types 6b1ee48

v0.0.8...v0.0.9

v0.0.8

23 Aug 10:27
5cd02b2
Compare
Choose a tag to compare
  • Merge pull request #8 from github/add-typescript-definition-file 23a859c
  • change callback return types to void from mixed a28805d
  • Merge branch 'master' of github.com:github/remote-form into add-typescript-definition-file 9346927
  • Merge pull request #10 from github/ci fe300ba
  • Use GitHub CI d27c2f3
  • statusText is not nullable 9e361d2
  • SimpleRequest.body cannot be undefined 4f07da1
  • use long form of a optional type fa7c3ae
  • add typescript definition file d02d369

v0.0.7...v0.0.8

0.0.8

23 Aug 10:26
23a859c
Compare
Choose a tag to compare

remote-form

A function that will enable submitting forms over AJAX.

The function will make a request based on the form using window.fetch with the payload encoded as URL parameters if the form method is a GET and FormData for all the other methods.

The request object is available in the callback function, allowing the headers and body to be modified before the request is sent.

Installation

$ npm install --save @github/remote-form

Usage

import {remoteForm} from '@github/remote-form'

// Make all forms that have the `data-remote` attribute a remote form.
remoteForm('form[data-remote]', async function(form, wants, request) {
  // Before we start the request
  form.classList.remove('has-error')
  form.classList.add('is-loading')

  let response
  try {
    response = await wants.html()
  } catch (error) {
    // If the request errored, we'll set the error state and return.
    form.classList.remove('is-loading')
    form.classList.add('has-error')
    return
  }

  // If the request succeeded we can do something with the results.
  form.classList.remove('is-loading')
  form.querySelector('.results').innerHTML = response.html
})
<form action="/signup" method="post" data-remote>
  <label for="username">Username</label>
  <input id="username" type="text">

  <label for="password">Username</label>
  <input id="password" type="password">

  <button type="submit">Log in</button>
  <div class="results"></div>
</form>

Browser support

Browsers without native custom element support require a polyfill.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

v0.0.7

08 Aug 09:06
c4ca873
Compare
Choose a tag to compare
  • Merge pull request #9 from github/publish-to-gpr-as-well f82d305
  • publish to GPR as a postpublish step 2cc3fa8
  • fix LICENSE link fe5a42b
  • Create CODE_OF_CONDUCT.md 070893d
  • Create CONTRIBUTING.md 4a60c28

v0.0.6...v0.0.7

0.0.7

08 Aug 09:05
f82d305
Compare
Choose a tag to compare

remote-form

A function that will enable submitting forms over AJAX.

The function will make a request based on the form using window.fetch with the payload encoded as URL parameters if the form method is a GET and FormData for all the other methods.

The request object is available in the callback function, allowing the headers and body to be modified before the request is sent.

Installation

$ npm install --save @github/remote-form

Usage

import {remoteForm} from '@github/remote-form'

// Make all forms that have the `data-remote` attribute a remote form.
remoteForm('form[data-remote]', async function(form, wants, request) {
  // Before we start the request
  form.classList.remove('has-error')
  form.classList.add('is-loading')

  let response
  try {
    response = await wants.html()
  } catch (error) {
    // If the request errored, we'll set the error state and return.
    form.classList.remove('is-loading')
    form.classList.add('has-error')
    return
  }

  // If the request succeeded we can do something with the results.
  form.classList.remove('is-loading')
  form.querySelector('.results').innerHTML = response.html
})
<form action="/signup" method="post" data-remote>
  <label for="username">Username</label>
  <input id="username" type="text">

  <label for="password">Username</label>
  <input id="password" type="password">

  <button type="submit">Log in</button>
  <div class="results"></div>
</form>

Browser support

Browsers without native custom element support require a polyfill.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

v0.0.6

23 Jul 14:36
7c7cbe7
Compare
Choose a tag to compare
  • npm audit fix ef7a85c
  • Merge pull request #7 from github/update-deps ffea302
  • update eslint, eslint-plugin-github and flow-bin manually to latest versiosn 2b34335
  • run npm update 42880ee
  • 0.0.5 13ad4fc

v0.0.5...v0.0.6

v0.0.5: Merge pull request #6 from github/fix-flow-file-declaraation

23 May 09:28
0a0daa3
Compare
Choose a tag to compare

v0.0.4

21 May 16:11
cdf1b62
Compare
Choose a tag to compare
  • declare SimpleRequest type cdf1b62
  • actually set flow annotation comment c625cb6

v0.0.3...v0.0.4

v0.0.3

21 May 13:29
af3f6f3
Compare
Choose a tag to compare
  • copy flow definitions to dist folder af3f6f3

v0.0.2...v0.0.3