js: document utils.ajax()
This commit is contained in:
parent
c6fff58f38
commit
7808f6dd4f
1 changed files with 7 additions and 0 deletions
|
@ -50,6 +50,13 @@ export function delegate(eventNames, selector, callback) {
|
|||
);
|
||||
}
|
||||
|
||||
// A promise-based wrapper for Rails.ajax().
|
||||
//
|
||||
// Returns a Promise that is either:
|
||||
// - resolved in case of a 20* HTTP response code,
|
||||
// - rejected with an Error object otherwise.
|
||||
//
|
||||
// See Rails.ajax() code for more details.
|
||||
export function ajax(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
Object.assign(options, {
|
||||
|
|
Loading…
Reference in a new issue