Checks if autostart is enabled
@param {String} key
@param {Function} callback
972725
function isAutostartEnabled(key, callback) {
  if (arguments.length < 1) {
    throw new Error('Not enough arguments passed to isAutostartEnabled()');
  } else if (typeof key !== 'string') {
    throw new TypeError('Passed "key" to disableAutostart() is not a string.');
  }

  if (typeof callback !== 'function') {
    return new Promise((resolve, reject) => {
      autostart.isAutostartEnabled(key, (error, isEnabled) => {
        if (error) {
          reject(error);
        } else {
          resolve(isEnabled);
        }
      });
    });
  }

  autostart.isAutostartEnabled(key, (error, isEnabled) => {
    callback(error, isEnabled);
  });
}
206914
private void removeEntriesStartingWith(String key) {
        synchronized (eventMap) {
            Iterator<String> iter = eventMap.keySet().iterator();
            while (iter.hasNext()) {
                String str = iter.next();
                if (str.startsWith(key)) {
                    iter.remove();
                }
            }
        }
    }
586461
function onActivate(event) {
  // Delete old caches to save space.
  const dropOldCaches = async () => {
    const cacheNames = await caches.keys();

    // Return true on all the caches we want to clean up.
    // Note that caches are shared across the origin, so only remove
    // caches we are sure we created.
    const cleanTheseUp = cacheNames.filter((cacheName) =>
        cacheName.startsWith(CACHE_NAME_PREFIX) && cacheName != CACHE_NAME);

    const cleanUpPromises =
        cleanTheseUp.map((cacheName) => caches.delete(cacheName));

    await Promise.all(cleanUpPromises);
  };

  event.waitUntil(dropOldCaches());
}
1133311
function start(autoExec) {
    debouncedEmit = debounce(emit, 1);
    win[ADD_EVENT_LISTENER](POPSTATE, debouncedEmit);
    win[ADD_EVENT_LISTENER](HASHCHANGE, debouncedEmit);
    doc[ADD_EVENT_LISTENER](clickEvent, click);

    if (autoExec) { emit(true); }
  }
470025
private function trackIfEnabled($key, \Closure $callback, $default = null)
    {
        return $this->isEnabled()
            ? ($this->getConfig("tracking.$key", false) ? $callback() : $default)
            : $default;
    }
976503
protected void callStart(final HttpCallback<?> callback, final Request request) {
        if (callback == null)
            return;
        callback.dispatchStart(request);
    }
321821
public Jawn onStartup(Runnable callback) {
        Objects.requireNonNull(callback);
        bootstrapper.onStartup(callback);
        return this;
    }
75310
public void begin(String key)
    {
        if (key == null)
        {
            return;
        }
        TimingData data = executionInfo.get(key);
        if (data == null)
        {
            data = new TimingData(key);
            executionInfo.put(key, data);
        }
        data.begin();
    }
921716
function (callback) {
            callback = backpack.ensure(callback, this);

            if (!this.paused) { return callback && callback(new Error('run: not paused')); }

            // set flag that it is no longer paused and fire the stored callback for the command when it was paused
            this.paused = false;
            setTimeout(function () {
                this.__resume();
                delete this.__resume;
                this.triggers.resume(null, this.state.cursor.current());
            }.bind(this), 0);

            callback && callback();
        }
1194622
function(callback) {
            var toInit = ['config', 'logger'];
            loader.loadServices(path.resolve(serverRoot, 'services'));
            injectDependencies(loader);

            loader.init(toInit, function(err) {
                callback(err);
            });
        }
637690
function () {
        var that = this,
            events = 'mouseover focus keydown',
            timer,
            callback = function () {
                that.initializer.resolve();
                that.enable();
            };

        that.initializer.always(function(){
            that.el.off(events, callback);
            clearInterval(timer);
        });

        that.disabled = true;
        that.el.on(events, callback);
        timer = setInterval(function(){
            if (that.el.is(':visible')) {
                callback();
            }
        }, that.options.initializeInterval);
    }
388348
function(callback) {
        if (this._isShuttingDown || this._isStartingUp) {
            return;
        }

        this._isShuttingDown = true;

        // See if the app is running.
        if (!this.processId() && !this.sideProcessId()) {
            this._isShuttingDown = false;
            // Nope, not running.
            if (callback) {
                callback();
            }

            return;
        }

        // Kill the app.
        clearTimeout(this._restartTimeout);
        this._appProcess.kill();
        if (this._sideProcess) {
            this._sideProcess.kill();
        }

        // Check on an interval to see if it's dead.
        var check = setInterval(_.bind(function() {
            if (this.processId() || this.sideProcessId()) {
                return;
            }

            clearInterval(check);
            logger.info('App shut down by force.');
            this._isShuttingDown = false;
            if (callback) {
                callback();
            }
        }, this), 250);
    }
49201
function(key, value, callback) {
        if (this.get(key) == value) {
            return;
        }

        this.set(key, value);
        clearTimeout(this._saveTimeout);
        this._saveTimeout = setTimeout(_.bind(function() {
            fs.writeFile(this._stateFile, JSON.stringify(this.attributes, null, '\t'), _.bind(function() {
                logger.info(key + ' saved to ' + path.join(process.cwd(), this._stateFile));
                while (this._callbacks && this._callbacks.length) {
                    this._callbacks.shift()();
                }
            }, this));
        }, this), 1000);

        if (callback) {
            if (!this._callbacks) {
                this._callbacks = [];
            }

            this._callbacks.push(callback);
        }
    }
14886
function start(callback) {
  let handle = {close(){server.close()}}
  check(function _check(err, inUse) {
    if (err) throw err
    if (inUse) {
      server = {close(){}}
      init(callback)
    }
    else {
      server = dynalite({
        createTableMs: 0
      }).listen(5000, function _server(err) {
        if (err) {
          // if we err then the db has been started elsewhere..
          // just try to continue
          console.log(err)
        }
        init(callback)
      })
    }
  })
  return handle
}
716524
function(force, callback) {

        // Don't start if we're waiting for it to finish starting already.
        var should = !this._isStartingUp;

        // Don't start if we're outside the schedule, unless requested by the console.
        should = should && (this._shouldBeRunning() || force === true);

        // Don't start if it's already running.
        should = should && !this.processId();

        // Don't start if there's no start command.
        should = should && this.get('launchCommand');

        if (!should) {
            return;
        }

        if (this.get('startupTimeout')) {
            this._isStartingUp = true;
        }

        if (this.processId()) {
            // It's already running.
            this._isStartingUp = false;
            if (callback) {
                callback(true);
            }

            return;
        }

        this._lastHeart = null;
        this._firstHeart = null;
        this._startupCallback = callback;

        var parts = this._parseCommand(this.get('launchCommand'));

        // Start the app.
        logger.info('App starting up.');
        this._appProcess = child_process.spawn(parts[0], parts.slice(1), {
            cwd: path.dirname(parts[0])
        })
            .on('exit', _.bind(function() {
                this._appProcess = null;
            }, this))
            .on('error', _.bind(function(err) {
                logger.error('Application could not be started. Is the launchCommand path correct?');
                this._appProcess = null;
            }, this));
        this._resetRestartTimeout(this.get('startupTimeout'));

        if (!this.get('sideCommand')) {
            return;
        }

        // Start the side process.
        parts = this._parseCommand(this.get('sideCommand'));
        this._sideProcess = child_process.spawn(parts[0], parts.slice(1), {
            cwd: path.dirname(parts[0])
        }).on('exit', _.bind(function() {
            this._sideProcess = null;
        }, this));
    }
888264
function (server, callback) {
            var self = this;

            this.$server = server;
            this._start(function(err) {
                self.$started = true;
                callback(err);
            });
        }
914415
@Override
    public void setAutoStart(boolean autoStart) throws IllegalStateRuntimeException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setAutoStart", new Object[] { autoStart });

        try {
            this.autoStart = autoStart;
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "setAutoStart", new Object[] { this.autoStart });
        }

    }