@shopify/performance
Advanced tools
Comparing version 1.1.8 to 1.2.0
@@ -8,4 +8,12 @@ # Changelog | ||
## [Unreleased] | ||
## [1.2.0] - 2019-10-03 | ||
### Changed | ||
- Updated the README to include instructions on cleaning up listeners from `performance.on` [[#1081](https://github.com/Shopify/quilt/pull/1081) | ||
## Added | ||
- Added a new API `mark` to the `Performance` class. This encapsulates both checking for `supportsMarks` and calling `window.performance.mark` into one call. [[#1083]](https://github.com/Shopify/quilt/pull/1083/files) | ||
## [1.1.2] - 2019-03-27 | ||
@@ -12,0 +20,0 @@ |
@@ -25,2 +25,3 @@ import { Navigation } from './navigation'; | ||
constructor(); | ||
mark(stage: string, id: string): void; | ||
on<T extends keyof EventMap>(event: T, handler: EventMap[T]): () => boolean; | ||
@@ -27,0 +28,0 @@ event(event: Event, { replace }?: { |
@@ -127,2 +127,7 @@ "use strict"; | ||
} | ||
Performance.prototype.mark = function (stage, id) { | ||
if (this.supportsMarks) { | ||
window.performance.mark(id + "::" + stage); | ||
} | ||
}; | ||
Performance.prototype.on = function (event, handler) { | ||
@@ -129,0 +134,0 @@ var e_1, _a; |
{ | ||
"name": "@shopify/performance", | ||
"version": "1.1.8", | ||
"version": "1.2.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Primitives for collecting browser performance metrics.", |
@@ -47,2 +47,10 @@ # `@shopify/performance` | ||
The `on` method returns a clean-up function that you can invoke when you're done listening on the event: | ||
```ts | ||
const cleanupNavigationListener = performance.on('navigation', navigation => {}); | ||
cleanupNavigationListener(); | ||
``` | ||
You can also manage navigations using this object. Calling `performance.start()` will begin a new navigation, cancelling any that are currently inflight. `performance.event()` allows you to register custom events on the navigation. Finally, `performance.finish()` marks the navigation is complete. | ||
@@ -49,0 +57,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43671
900
97