define({ pluginBuilder: './text_builder', load: function(name, req, onload, config) { 'use strict'; var url = req.toUrl(name), xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onreadystatechange = function(evt) { var status, err; if (xhr.readyState === 4) { status = xhr.status; if (status > 399 && status < 600) { //An http 4xx or 5xx error. Signal an error. err = new Error(url + ' HTTP status: ' + status); err.xhr = xhr; onload.error(err); } else { onload(xhr.responseText); } } }; xhr.responseType = 'text'; xhr.send(null); } });