CLEARINTERVAL

Clears an interval that was previously started with SETINTERVAL.

Description

The CLEARINTERVAL function clears an interval that was previously started with SETINTERVAL.

Parameters

intervalID Number (required) - The interval ID to clear

Examples

// Starts an interval to update the GPS accuracy every 5 seconds and stops updating after 2 minutes.
ON('load-record', function(event) {
  var fiveSeconds = 1000 * 5;
  var twoMinutes = 1000 * 60 * 2;

  var interval = SETINTERVAL(function() {
    if (CURRENTLOCATION()) {
      SETLABEL('accuracy', CURRENTLOCATION().accuracy);
    }
  }, fiveSeconds);

  SETTIMEOUT(function() {
    CLEARINTERVAL(interval);
  }, twoMinutes);
});

Did this page help you?