Skip to content
Eric edited this page Feb 16, 2018 · 162 revisions

Popups

Popups are parts of the core, have a size and a view. For the following documentation consider app being an instance of MobileCore. There can only be one popup at a time.

Instantiate

 let config = {
      width:_NUMBER_|_STRING_, //Required, either a number (for pixels) or a percentage 
      height:_NUMBER_|_STRING_, //Required, either a number (for pixels) or a percentage 
      view:_STRING_, //Optional, the view to instantiate in the popup
      config:_OBJECT_, //Optional, the config object for the view
      html:_STRING_, //Optional, some HTML content to add to the body of the popup
      animation:_STRING_, //Optional, defaults to OGX.MobileCore.POPUP_FADE 
      listen_overlay:_BOOLEAN_, //Optional, if the core should listen for clicks on the overlay and hide it
 };
 app.addPopup(config);

Example - Create a popup of 400x300px, pass it a view 'MyView', with an empty object, a fade animation and ignore user interactions on the underlying overlay (tapping the overlay won't do anything).

 app.addPopp({width:400, height:300, view:'MyView', config:{}, animation:OGX.MobileCore.POPUP_FADE, listen_overlay:false});

Same but with percent instead

 app.addPopp({width:'80%', height:'80%', view:'MyView', config:{}, animation:OGX.MobileCore.POPUP_FADE, listen_overlay:false});

Delete

 app.removePopup(_ANIMATION_);

Deleting a popup will also call the destroy method of a view.

Clone this wiki locally