action to perform on state change
773315
function() {
        // unsubscribe to all events
        me.event.unsubscribe(this.pointerEvent);
        me.event.unsubscribe(this.viewportEvent);
        me.input.releasePointerEvent("pointermove", me.game.viewport);
    }
668856
def _on_changed(self):
        """"""
        page = self._get_page()
        if not page.flag_autosave:
            page.flag_changed = True
            self._update_gui_text_tabs()
365576
def add(self, action):
        """"""
        self._state_machine.transition_to_add()
        self._actions.append(action)
1256681
def on_state_changed(self, state):
        
        if state:
            self.editor.sig_breakpoints_changed.connect(self.repaint)
            self.editor.sig_debug_stop.connect(self.set_current_line_arrow)
            self.editor.sig_debug_stop[()].connect(self.stop_clean)
            self.editor.sig_debug_start.connect(self.start_clean)
        else:
            self.editor.sig_breakpoints_changed.disconnect(self.repaint)
            self.editor.sig_debug_stop.disconnect(self.set_current_line_arrow)
            self.editor.sig_debug_stop[()].disconnect(self.stop_clean)
            self.editor.sig_debug_start.disconnect(self.start_clean)
48322
def _call_when_changed(self, ticks, state):
        
        method = self._when_changed()
        if method is None:
            self.when_changed = None
        else:
            method(ticks, state)
1314638
def on_click(self, handler):
        
        self.on_change('active', lambda attr, old, new: handler(new))
1275077
function doAction() {
            var now = (new Date()).getTime();
            var diff = now - lastTapTime;
            var isDiffElemSafeDelay = elem !== lastElemTapped && diff > 200;
            var isSameElemSafeDelay = elem === lastElemTapped && diff > sameElemSafeDelay;

            if (tapped && (isDiffElemSafeDelay || isSameElemSafeDelay)) {
                lastElemTapped = elem;
                lastTapTime = now;
                safeApply(action, scope);
            }

            // reset tapped at end
            tapped = false;
        }
948507
function(name, datasetId) {
            name = name || '$stateChangeSuccess';
            datasetId = datasetId || 'default';
            $rootScope.$on(name, function (event, args) {
                visible.setActive(args.name, datasetId);
            });
        }
1175840
def on_menu(self, event):
        ''''''
        state = self.state
        ret = self.menu.find_selected(event)
        if ret is None:
            return
        ret.call_handler()
        state.child_pipe_send.send(ret)
84108
def on_top_level_changed(self, top_level):
        """"""
        if top_level:
            self.undock_action.setDisabled(True)
        else:
            self.undock_action.setDisabled(False)
553324
def _on_state_changed(self):
        """"""
        raw_state, generation = self.state.raw_state_and_generation
        if generation != self._last_generation:
            self._last_generation = generation
            self._send_update(raw_state, generation)
391749
def on_state_changed(self, state):
        
        if state:
            self.editor.painted.connect(self._paint_margin)
            self.editor.repaint()
        else:
            self.editor.painted.disconnect(self._paint_margin)
            self.editor.repaint()
1279410
@Override
    public void doAction(Action action) {
        switch (action) {
            case REMOVE:
                close();
                break;
            
            case HIDE:
                setVisible(false);
                break;
            
            case SHOW:
                setVisible(true);
                break;
            
            case COLLAPSE:
                setSize(Size.MINIMIZED);
                break;
            
            case EXPAND:
                setSize(Size.NORMAL);
                break;
            
            case TOP:
                moveToTop();
                break;
        }
    }
405800
private void setState(State state) {
    if (this.state != state) {
      this.state = state;
      LOGGER.debug("State changed: {}", state);
      changeListeners.forEach(l -> l.accept(state));
    }
  }
1136130
public void toggle() {
    Command cmd = state.isPrimary() ? command1 : command2;
    setState(state.other());
    cmd.execute();
  }
999950
private void setState(State state) {
    if (this.state != state) {
      this.state = state;
      log.debug("State changed: {}", state);
    }
  }
995404
function _switchState(state) {
            // clear previous interval if any
            _stopRunLoop();

            // call the stage destroy method
            if (_stages[_state]) {
                // just notify the object
                _stages[_state].stage.destroy();
            }

            if (_stages[state]) {
                // set the global variable
                _state = state;

                // call the reset function with _extraArgs as arguments
                _stages[_state].stage.reset.apply(_stages[_state].stage, _extraArgs);

                // and start the main loop of the
                // new requested state
                _startRunLoop();

                // execute callback if defined
                if (_onSwitchComplete) {
                    _onSwitchComplete();
                }

                // force repaint
                me.game.repaint();
            }
        }