MCPcopy Create free account
hub / github.com/tree-sitter/tree-sitter-javascript / done

Function done

examples/jquery.js:8165–8275  ·  view source on GitHub ↗
( status, nativeStatusText, responses, headers )

Source from the content-addressed store, hash-verified

8163
8164 // Callback for when everything is done
8165 function done( status, nativeStatusText, responses, headers ) {
8166 var isSuccess, success, error, response, modified,
8167 statusText = nativeStatusText;
8168
8169 // Called once
8170 if ( state === 2 ) {
8171 return;
8172 }
8173
8174 // State is "done" now
8175 state = 2;
8176
8177 // Clear timeout if it exists
8178 if ( timeoutTimer ) {
8179 clearTimeout( timeoutTimer );
8180 }
8181
8182 // Dereference transport for early garbage collection
8183 // (no matter how long the jqXHR object will be used)
8184 transport = undefined;
8185
8186 // Cache response headers
8187 responseHeadersString = headers || "";
8188
8189 // Set readyState
8190 jqXHR.readyState = status > 0 ? 4 : 0;
8191
8192 // Determine if successful
8193 isSuccess = status >= 200 && status < 300 || status === 304;
8194
8195 // Get response data
8196 if ( responses ) {
8197 response = ajaxHandleResponses( s, jqXHR, responses );
8198 }
8199
8200 // Convert no matter what (that way responseXXX fields are always set)
8201 response = ajaxConvert( s, response, jqXHR, isSuccess );
8202
8203 // If successful, handle type chaining
8204 if ( isSuccess ) {
8205
8206 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8207 if ( s.ifModified ) {
8208 modified = jqXHR.getResponseHeader("Last-Modified");
8209 if ( modified ) {
8210 jQuery.lastModified[ cacheURL ] = modified;
8211 }
8212 modified = jqXHR.getResponseHeader("etag");
8213 if ( modified ) {
8214 jQuery.etag[ cacheURL ] = modified;
8215 }
8216 }
8217
8218 // if no content
8219 if ( status === 204 || s.type === "HEAD" ) {
8220 statusText = "nocontent";
8221
8222 // if not modified

Callers 1

jquery.jsFile · 0.85

Calls 2

ajaxHandleResponsesFunction · 0.85
ajaxConvertFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…