[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> api-fetch.js (summary)

(no description)

File Size: 772 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 8 functions

  createNonceMiddleware()
  createPreloadingMiddleware()
  prepareResponse()
  parseAndThrowError()
  isMediaUploadRequest()
  registerMiddleware()
  setFetchHandler()
  apiFetch()

Functions
Functions that are not part of a class:

createNonceMiddleware(nonce)   X-Ref

return: {import('../types').APIFetchMiddleware & { nonce: string }} A middleware to enhance a request with a nonce.
param: {string} nonce

createPreloadingMiddleware(preloadedData)   X-Ref

return: {import('../types').APIFetchMiddleware} Preloading middleware.
param: {Record<string, any>} preloadedData

prepareResponse(responseData, parse)   X-Ref
This is a helper function that sends a success response.

return: {Promise<any>} Promise with the response.
param: {Record<string, any>} responseData
param: {boolean}             parse

parseAndThrowError(response, shouldParseResponse = true)   X-Ref
Parses a response, throwing an error if parsing the response fails.

return: {Promise<any>} Parsed response.
param: {Response} response
param: {boolean}  shouldParseResponse

isMediaUploadRequest(options)   X-Ref

return: {boolean} True if the request is for media upload.
param: {import('../types').APIFetchOptions} options

registerMiddleware(middleware)   X-Ref
Register a middleware

param: {import('./types').APIFetchMiddleware} middleware

setFetchHandler(newFetchHandler)   X-Ref
Defines a custom fetch handler for making the requests that will override
the default one using window.fetch

param: {FetchHandler} newFetchHandler The new fetch handler

apiFetch(options)   X-Ref

return: {Promise<T>} A promise representing the request processed via the registered middlewares.
param: {import('./types').APIFetchOptions} options



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref