Skip to content

Commit

Permalink
Adds the timestamp of the start of an SC.Request
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbadia authored and root committed Feb 3, 2017
1 parent 4b3a150 commit 3ae7717
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frameworks/ajax/system/request.js
Expand Up @@ -344,6 +344,14 @@ SC.Request = SC.Object.extend(SC.Copyable, SC.Freezable,
*/
body: null,

/**
The timestamp of the start of the request.
@type Number
@default null
*/
requestTime: null,

/**
The body, encoded as JSON or XML if needed.
Expand Down
2 changes: 2 additions & 0 deletions frameworks/ajax/system/response.js
Expand Up @@ -248,6 +248,8 @@ SC.Response = SC.Object.extend(
// first give the source a chance to fixup the request and response
// then freeze req so no more changes can happen.
if (source && source.willSend) { source.willSend(req, this); }

req.set('requestTime', Date.now());
req.freeze();

// if the source did not cancel the request, then invoke the transport
Expand Down

0 comments on commit 3ae7717

Please sign in to comment.