{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/6649","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/6649/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/6649/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/6649/events","html_url":"https://github.com/mrdoob/three.js/pull/6649","id":85166559,"number":6649,"title":"Dev","user":{"login":"SirNeuman","id":6912634,"avatar_url":"https://avatars.githubusercontent.com/u/6912634?v=3","gravatar_id":"","url":"https://api.github.com/users/SirNeuman","html_url":"https://github.com/SirNeuman","followers_url":"https://api.github.com/users/SirNeuman/followers","following_url":"https://api.github.com/users/SirNeuman/following{/other_user}","gists_url":"https://api.github.com/users/SirNeuman/gists{/gist_id}","starred_url":"https://api.github.com/users/SirNeuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirNeuman/subscriptions","organizations_url":"https://api.github.com/users/SirNeuman/orgs","repos_url":"https://api.github.com/users/SirNeuman/repos","events_url":"https://api.github.com/users/SirNeuman/events{/privacy}","received_events_url":"https://api.github.com/users/SirNeuman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-04T16:14:36Z","updated_at":"2015-06-05T22:29:33Z","closed_at":"2015-06-05T17:27:45Z","pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/6649","html_url":"https://github.com/mrdoob/three.js/pull/6649","diff_url":"https://github.com/mrdoob/three.js/pull/6649.diff","patch_url":"https://github.com/mrdoob/three.js/pull/6649.patch"},"body":"So I the main thing I added was returning the XMLHttpRequest object from the XHRLoader. This gives other loaders that use the XHRLoader object (such as STLLoader) access to the XMLHttpRequest object. Therefore allowing manipulation of the XMLHttpRequest object and access to the built in functions of the object. Mainly XMLHttpRequest.abort() so when using STLLoader one can cancel the load by calling abort on the request object. Issues #6641 and #6634 are relevant here.\r\n\r\nHere's an example of code for how the changes can be useful.\r\n```\r\nvar loader = new THREE.STLLoader();\r\nvar request = {};\r\n\r\nfunction loadMyObj(url){\r\n    request = loader.load(url, function(object){\r\n        scene.add(object);\r\n    }\r\n}\r\n\r\nfunction cancelLoad(){\r\n    request.abort();\r\n}\r\n```\r\nI only added to the STLLoader in examples > js but this can be easily added to the any other loaders that use XHRLoader. "},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/109464610","html_url":"https://github.com/mrdoob/three.js/pull/6649#issuecomment-109464610","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/6649","id":109464610,"user":{"login":"SirNeuman","id":6912634,"avatar_url":"https://avatars.githubusercontent.com/u/6912634?v=3","gravatar_id":"","url":"https://api.github.com/users/SirNeuman","html_url":"https://github.com/SirNeuman","followers_url":"https://api.github.com/users/SirNeuman/followers","following_url":"https://api.github.com/users/SirNeuman/following{/other_user}","gists_url":"https://api.github.com/users/SirNeuman/gists{/gist_id}","starred_url":"https://api.github.com/users/SirNeuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirNeuman/subscriptions","organizations_url":"https://api.github.com/users/SirNeuman/orgs","repos_url":"https://api.github.com/users/SirNeuman/repos","events_url":"https://api.github.com/users/SirNeuman/events{/privacy}","received_events_url":"https://api.github.com/users/SirNeuman/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T22:29:33Z","updated_at":"2015-06-05T22:29:33Z","body":"1. Hmmm. I think we want it to return the `request` consistently when calling `load()`. However, I'm not too familiar with THREE.Cache, though THREE.Cache seems straightforward enough.\r\n```\r\nif ( cached !== undefined ) {\r\n\tif ( onLoad ) onLoad( cached );\r\n\treturn;\r\n}\r\n```\r\nI'm not too sure what purpose this serves. Either way, for the purpose of calling `abort()` at least,  when calling the XHRLoader to start loading, it will pass the `return onLoad` and eventually get to returning `request`. So for canceling the load (which was the motivation behind updating this function) this will work as expected. \r\n\r\n2. I didn't make any changes there, so I don't know. But it seems to me like it should use `scope.response` though i'm not sure what difference that would make."}}