How to use the mson/lib/globals.displayConfirmation function in mson

To help you get started, we’ve selected a few mson examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github redgeoff / mson-react / src / app.js View on Github external
onNavigate = callback => {
    // We don't warn about discarding changes when fullScreen, e.g. a login page
    const menuItem = this.state.menuItem;
    if (
      menuItem &&
      menuItem.content.has('dirty') &&
      menuItem.content.get('dirty') &&
      !menuItem.fullScreen
    ) {
      // Show a confirmation dialog to see if the user wants to continue
      globals.displayConfirmation({
        title: 'Discard changes?',
        callback
      });
    } else {
      // Nothing is dirty so allow the navigation to continue
      callback(true);
    }
  };