-
Notifications
You must be signed in to change notification settings - Fork 14
backEvent
Guillaume Gendre edited this page Apr 29, 2019
·
6 revisions
Sometimes, you want to :
- disable the back button,
- ask the user before quitting an app,
- do something before poping back
- allow back button usage on a condition.
To know when the back button is pressed you can catch the cobalt:onBackButtonPressed
event.
cobalt.subscribe("cobalt:onBackButtonPressed", function(){
cobalt.log('you pressed back button');
//To allow, just pop.
cobalt.navigate.pop();
//To disallow, just do nothing.
});
Cobalt allows the back button if you don't catch this event.
Cobalt is an Open-Source Hybrid Mobile Framework. Read more about it on the home page or in the documentation
- Introduction to Cobalt navigation
- The cobalt.json file
- native navigation bars
- Handling the Android back button
- Introduction to Cobalt messages
- Publish/Subscribe on the Web side
- Publish/Subscribe on Android
- Publish/Subscribe on iOS
- Web Lifecycle messages
- Pull-To-Refresh and Infinite Scroll
- Custom alerts and Toasts
- LocalStorage
- OpenExternalUrl
- PlatformInfos
- Ajax
- Removing the top bar
- Adding Cobalt to an existing project
- Customizing your hybrid views
- Handle multiple Cobalt webviews on the same screen (TODO)