1/** 2 * Copyright © Magento, Inc. All rights reserved. 3 * See COPYING.txt for license details. 4 */ 5 6define(['jquery', 'mage/url'], function ($, urlBuilder) { 7 'use strict'; 8 9 return { 10 /** 11 * Perform asynchronous GET request to server. 12 * @param {String} url 13 * @param {Boolean} global 14 * @param {String} contentType 15 * @param {Object} headers 16 * @returns {Deferred} 17 */ 18 get: function (url, global, contentType, headers) { 19 headers = headers || {}; 20 global = global === undefined ? true : global; 21 contentType = contentType || 'application/json'; 22 23 return $.ajax({ 24 url: urlBuilder.build(url), 25 type: 'GET', 26 global: global, 27 contentType: contentType, 28 headers: headers 29 }); 30 }, 31 32 /** 33 * Perform asynchronous POST request to server. 34 * @param {String} url 35 * @param {String} data 36 * @param {Boolean} global 37 * @param {String} contentType 38 * @param {Object} headers 39 * @param {Boolean} async 40 * @returns {Deferred} 41 */ 42 post: function (url, data, global, contentType, headers, async) { 43 headers = headers || {}; 44 global = global === undefined ? true : global; 45 contentType = contentType || 'application/json'; 46 async = async === undefined ? true : async; 47 48 return $.ajax({ 49 url: urlBuilder.build(url), 50 type: 'POST', 51 data: data, 52 global: global, 53 contentType: contentType, 54 headers: headers, 55 async: async 56 }); 57 }, 58 59 /** 60 * Perform asynchronous PUT request to server. 61 * @param {String} url 62 * @param {String} data 63 * @param {Boolean} global 64 * @param {String} contentType 65 * @param {Object} headers 66 * @returns {Deferred} 67 */ 68 put: function (url, data, global, contentType, headers) { 69 var ajaxSettings = {}; 70 71 headers = headers || {}; 72 global = global === undefined ? true : global; 73 contentType = contentType || 'application/json'; 74 ajaxSettings.url = urlBuilder.build(url); 75 ajaxSettings.type = 'PUT'; 76 ajaxSettings.data = data; 77 ajaxSettings.global = global; 78 ajaxSettings.contentType = contentType; 79 ajaxSettings.headers = headers; 80 81 return $.ajax(ajaxSettings); 82 }, 83 84 /** 85 * Perform asynchronous DELETE request to server. 86 * @param {String} url 87 * @param {Boolean} global 88 * @param {String} contentType 89 * @param {Object} headers 90 * @returns {Deferred} 91 */ 92 delete: function (url, global, contentType, headers) { 93 headers = headers || {}; 94 global = global === undefined ? true : global; 95 contentType = contentType || 'application/json'; 96 97 return $.ajax({ 98 url: urlBuilder.build(url), 99 type: 'DELETE', 100 global: global, 101 contentType: contentType, 102 headers: headers 103 }); 104 } 105 }; 106});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.