@frui.ts/screens
Advanced tools
Comparing version 0.16.3 to 0.16.4
@@ -0,1 +1,2 @@ | ||
import { IScreen } from "../structure/types"; | ||
import { NavigationPath } from "./navigationPath"; | ||
@@ -6,2 +7,7 @@ export interface ICanNavigate { | ||
} | ||
export interface INavigatedEvent { | ||
screenName: string; | ||
screen: IScreen; | ||
url: string; | ||
} | ||
export interface INavigationParent<TChild> { | ||
@@ -8,0 +14,0 @@ getChildNavigationPath(child: TChild | string | number, childParams?: any): NavigationPath; |
@@ -95,2 +95,6 @@ "use strict"; | ||
} | ||
var navigateEvent = new CustomEvent("fruitsNavigated", { | ||
detail: { screenName: screen.name, screen: screen, url: window.location.toString() }, | ||
}); | ||
window.dispatchEvent(navigateEvent); | ||
this.lastActiveScreen = screen; | ||
@@ -97,0 +101,0 @@ }; |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.16.3", | ||
"version": "0.16.4", | ||
"description": "Frui.ts core classes for application structure and navigation", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@frui.ts/helpers": "^0.16.3", | ||
"@frui.ts/helpers": "^0.16.4", | ||
"query-string": "^6.9.0", | ||
@@ -49,3 +49,3 @@ "route-parser": "^0.0.5" | ||
}, | ||
"gitHead": "fc58a17e18bea299f6aeb6f1090569443eccaafc" | ||
"gitHead": "ed46bca2ee935924ebac2428711a42c7ef566552" | ||
} |
@@ -252,1 +252,19 @@ # `@frui.ts/screens` | ||
Implement `ICanNavigate` if you want to control the navigation path for children and react to changes in the navigation path. Note that the conductors described above already implement `ICanNavigate`. | ||
### Navigated event | ||
`UrlNavigationAdapter` triggers the `fruitsNavigated` event. | ||
You can listen for this event in your application, for example to report `pageView` to Google Analytics. | ||
```typescript | ||
interface INavigatedEvent { | ||
screenName: string; | ||
screen: IScreen; | ||
url: string; | ||
} | ||
window.addEventListener("fruitsNavigated", this.onNavigated); | ||
onNavigated(e: CustomEventInit<INavigatedEvent>) { | ||
console.log(e.detail?.url); | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
172845
2066
270
Updated@frui.ts/helpers@^0.16.4