Closed woutersteven closed 1 year ago
@woutersteven2020 Thank you, I'm understand the issue.
Good a feature request, it's would be nice access to Pane instances from window
object, from any code part, like window['pane']: [CupertinoPane, CupertinoPane, CupertinoPane, ...]
.
I will review this feature for the future.
For now, I suggest you to place your pane to some Singleton service where you collect global app variables:
import { SharedService } from '../services/shared/shared/shared.service.ts';
constructor (shared: SharedService) {
// when you initiate a pane save it to shared scope
this.shared.pane = new CupertinoPane(...);
}
Than access it from your hardware button service.
Some similar issues about hardware button (#143, #150)
Thank you for your reply. I wrote Singeton service and updated my hardwareBackButtonEvent() to check for openPanes first (and close them) before trying to navigate back through the history, it's working nicely!
What are you trying to add to Cupertino-Pane? Ability to close any and all existing panes.
Describe your feature request detailed Throughout my Ionic App i use Cupertino Panes (they're great) and i track my hardware back button (see below)... it goes back in the navigation stack and shows a toast "press back again to exist app" once it has reached the last page. This is working well.
I want to add something, so that when a pane is opened... it is closed first when somebody presses the back button.. and then the normal behaviour continues.
This function (see below) is in a service file, and doesn't have access to the components in which the panes are presented.
I'm not sure how best to approach it, perhaps with events. that when i create a pane, it sends a signal to the navigation service? i'm not sure.
Is there an alternative at the latest version?
[ ] Yes (descripe the alternative) [X] No
Is this related to an issue?
[ ] Yes (Give a link to the issue) [X] No