Sha256: 4cf87c9f13555909c54ceeb40777d555dcc04f1847afc57df3c6d337d512fc58
Contents?: true
Size: 1.47 KB
Versions: 5
Compression:
Stored size: 1.47 KB
Contents
/*global define*/ define(['Core/loadWithXhr'], function( loadWithXhr) { "use strict"; /** * Asynchronously loads the given URL as text. Returns a promise that will resolve to * a String once loaded, or reject if the URL failed to load. The data is loaded * using XMLHttpRequest, which means that in order to make requests to another origin, * the server must have Cross-Origin Resource Sharing (CORS) headers enabled. * * @exports loadText * * @param {String|Promise} url The URL to request, or a promise for the URL. * @param {Object} [headers] HTTP headers to send with the request. * @returns {Promise} a promise that will resolve to the requested data when loaded. * * @exception {DeveloperError} url is required. * * @example * // load text from a URL, setting a custom header * loadText('http://someUrl.com/someJson.txt', { * 'X-Custom-Header' : 'some value' * }).then(function(text) { * //Do something with the text * }, function() { * // an error occurred * }); * * @see <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XMLHttpRequest</a> * @see <a href='http://www.w3.org/TR/cors/'>Cross-Origin Resource Sharing</a> * @see <a href='http://wiki.commonjs.org/wiki/Promises/A'>CommonJS Promises/A</a> */ var loadText = function(url, headers) { return loadWithXhr(url, undefined, headers); }; return loadText; });
Version data entries
5 entries across 5 versions & 1 rubygems