_PausableMixin

A widget that should be pausable in the user interface should extend this mixin.
This class can be extended by widgets which should be pausable. Think of intervals that do resource intensive stuff, which should not always be running. When the focus of the tab this widget is on toggles (either by switching tab in BlueConic or by losing browser focus), the events are thrown.

A widget that mixes this mixin is responsible for listening to these events and handling them.

Example
define([
  "dojo/_base/declare",
  "dojo/on",
  "dijit/_WidgetBase",
  "blueconic/api/widgets/mixins/_PausableMixin"
], function(declare, on, _WidgetBase, _PausibleMixin) {
  return declare("your.package.widget", [_WidgetBase, _PausibleMixin], {

    postCreate: function(){
      this.inherited(arguments);

      // use own to cleanup event handles after destroying the widget
      this.own(
        on(this, "continue", lang.hitch(this, this._startResourceIntensiveMethod()),
        on(this, "pause", lang.hitch(this, this._stopResourceIntensiveMethod())
      );
    }

    // other methods
  });
});

Events

onContinue()

Called when widget should start activity.

onPause()

Called when widget should pause activity.