surfnperf 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46ee4188cffa658ea602909af49212b2528b998b
4
- data.tar.gz: df48352a3bbc01ac8b20af12c642ded23cb1b698
3
+ metadata.gz: 2ebf230cbfd8dc288c35183b576965432d010f93
4
+ data.tar.gz: 5ea5493fe01a15c3e89e310a85619c5a10f737c7
5
5
  SHA512:
6
- metadata.gz: d9f9d49083a9bec41683de7cb41d6d3ba081b8415d04f8d36ff793faf1b00f29495a51e8d42c8c3624b2958821d445a6cb2d5ae60c058fb14d30a98341202003
7
- data.tar.gz: 1c2790b4a37e0ec81aebd4c6242f59630d7152d0c5c312b06f2757abf52a88765a24dd716636d2b45adc51df551bb6abf70280116a1e0618d7a0c99d0d3b4f31
6
+ metadata.gz: a7d39899a860a238186e9228f1b404ffee2a09cd79ef43f2e415153a10f685730d41eba4af6f66b6ad2e51b413b8bace3e567a5c831f47d1c5dfc7555dfb7874
7
+ data.tar.gz: 57d0f1897109c30d5f1e3a3084e8277ad826916b0b6e767947053d0c5c390e429f490f7fc1e0dd18d2b504c6bab63734b01de2e939919e81808e10d7e31bcdd4
@@ -123,7 +123,7 @@
123
123
  /**
124
124
  * Returns the timing data for a particular eventKey
125
125
  *
126
- * @arguments {String} timeType 'highRes' (to return a DOMHighResTimeStamp, if available) or 'DOM' (to return a DOMTimeStamp's value) - optional. Defaults to 'highRes'
126
+ * @param {String} timeType 'highRes' (to return a DOMHighResTimeStamp, if available) or 'DOM' (to return a DOMTimeStamp's value) - optional. Defaults to 'highRes'
127
127
  * @returns {DOMHighResTimeStamp | integer} time value
128
128
  * @memberOf SurfNPerf
129
129
  */
@@ -151,8 +151,8 @@
151
151
  /**
152
152
  * Returns the timing data for a particular eventKey
153
153
  *
154
- * @arguments {String} eventKey name of the timing event
155
- * @arguments {String} timeType 'highRes' (to return a DOMHighResTimeStamp, if available) or 'DOM' (to return a DOMTimeStamp's value) - optional. Defaults to 'DOM'
154
+ * @param {String} eventKey name of the timing event
155
+ * @param {String} timeType 'highRes' (to return a DOMHighResTimeStamp, if available) or 'DOM' (to return a DOMTimeStamp's value) - optional. Defaults to 'DOM'
156
156
  * @returns {DOMHighResTimeStamp | integer} time value
157
157
  * @memberOf SurfNPerf
158
158
  */
@@ -199,6 +199,46 @@
199
199
  return mark || this._data.marks[eventKey] || window.SURF_N_PERF.marks[eventKey];
200
200
  };
201
201
 
202
+ /**
203
+ * Removes all user-set marks (or just the specified one) and their associated time values. Will not remove the loadEventEnd mark.
204
+ *
205
+ * @param {String} [eventKey] removes all time values for the given eventKey
206
+ * @memberOf SurfNPerf
207
+ */
208
+ SNPProto.clearMarks = function(eventKey) {
209
+ var loadEventEndHighRes = window.SURF_N_PERF.highResMarks.loadEventEnd,
210
+ loadEventEnd = window.SURF_N_PERF.marks.loadEventEnd;
211
+
212
+ if(this._userTiming) {
213
+ this.userTiming().clearMarks(eventKey);
214
+ }
215
+ if(eventKey) {
216
+ if(eventKey !== 'loadEventEnd') {
217
+ delete this._data.highResMarks[eventKey];
218
+ delete this._data.marks[eventKey];
219
+ delete window.SURF_N_PERF.highResMarks[eventKey];
220
+ delete window.SURF_N_PERF.marks[eventKey];
221
+ }
222
+ } else {
223
+ this._data.highResMarks = {};
224
+ this._data.marks = {};
225
+ if(loadEventEndHighRes) {
226
+ window.SURF_N_PERF.highResMarks = {
227
+ loadEventEnd: loadEventEndHighRes
228
+ };
229
+ } else {
230
+ window.SURF_N_PERF.highResMarks = {};
231
+ }
232
+ if(loadEventEnd) {
233
+ window.SURF_N_PERF.marks = {
234
+ loadEventEnd: loadEventEnd
235
+ };
236
+ } else {
237
+ window.SURF_N_PERF.marks = {};
238
+ }
239
+ }
240
+ };
241
+
202
242
  SNPProto._isTimingMark = function(eventKey) {
203
243
  return contains(this._navigationTimingEvents.a.concat(this._navigationTimingEvents.b), eventKey);
204
244
  };
@@ -372,6 +412,10 @@
372
412
  }
373
413
  };
374
414
 
415
+ SNPProto._supportsRequestAnimationFrame = function() {
416
+ return !!window.requestAnimationFrame;
417
+ };
418
+
375
419
  /**
376
420
  * Time to first paint (Time calculated based on window.requestAnimationFrame() for the first pixels to be rendered on the page)
377
421
  *
@@ -379,7 +423,7 @@
379
423
  * @memberOf SurfNPerf
380
424
  */
381
425
  SNPProto.getFirstPaintFrame = function(options) {
382
- if(window.requestAnimationFrame) {
426
+ if(this._supportsRequestAnimationFrame()) {
383
427
  return this.duration('navigationStart', 'firstPaintFrame', options);
384
428
  } else {
385
429
  return null;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surfnperf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Riviello
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 2.4.3
76
+ rubygems_version: 2.6.10
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Micro-library for gathering frontend web page performance data