action to perform on state change
432216
function() {
        // clear the background
        me.game.world.addChild(new me.ColorLayer("background", "#000000", 0), 0);
        // add a few squares
        me.game.world.addChild(new game.square(200, 230, {width: 100, height: 100}), 1);

        // add a droptarget entity
        me.game.world.addChild(new game.droptarget(400, 200, {width: 200, height: 150}), 1);

        // add another droptarget entity
        me.game.world.addChild(new game.droptarget2(400, 400, {width: 200, height: 150}), 1);
    }
661327
def on_state_changed(self, state):
        
        if state:
            self.editor.painted.connect(self._paint_margins)
            self.editor.key_pressed.connect(self._on_key_pressed)
            self.editor.repaint()
        else:
            self.editor.painted.disconnect(self._paint_margins)
            self.editor.key_pressed.disconnect(self._on_key_pressed)
            self.editor.repaint()
484809
private void fireStateChanged(Object node, State oldState, State newState)
    {
        for (StateListener stateListener : stateListeners)
        {
            stateListener.stateChanged(node, oldState, newState);
        }
    }
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;
        }
669941
def on_state_changed(self, state):
        """"""
        if state:
            self.editor.sig_key_pressed.connect(self._on_key_pressed)
        else:
            self.editor.sig_key_pressed.disconnect(self._on_key_pressed)
262965
def register_actions(self, shortcut_manager):
        
        shortcut_manager.add_callback_for_action('rename', self.rename_selected_state)
        super(StatesEditorController, self).register_actions(shortcut_manager)
130414
def on_state_changed(self, state):
        
        if state:
            self.editor.key_pressed.connect(self._on_key_pressed)
            if self._highlight_caret:
                self.editor.cursorPositionChanged.connect(
                    self._highlight_caret_scope)
                self._block_nbr = -1
            self.editor.new_text_set.connect(self._clear_block_deco)
        else:
            self.editor.key_pressed.disconnect(self._on_key_pressed)
            if self._highlight_caret:
                self.editor.cursorPositionChanged.disconnect(
                    self._highlight_caret_scope)
                self._block_nbr = -1
            self.editor.new_text_set.disconnect(self._clear_block_deco)
402360
async def _on_status_change(self, update):
        """"""

        info = update['payload']
        new_number = info['new_status']
        name = update['service']

        if name not in self.services:
            return

        with self._state_lock:
            is_changed = self.services[name].state != new_number
            self.services[name].state = new_number

        # Notify about this service state change if anyone is listening
        if self._on_change_callback and is_changed:
            self._on_change_callback(name, self.services[name].id, new_number, False, False)
462746
def on_state(self, *args):
        """"""
        # This really ought to be done with the selection behavior
        if self.state == 'down':
            self.rulesview.rule = self.rule
            for button in self.ruleslist.children[0].children:
                if button != self:
                    button.state = 'normal'
306177
private void updateState(final TaskStatus.State state) {
    statusUpdater.setState(state);
    // Commit and push a new status
    try {
      statusUpdater.update();
    } catch (InterruptedException e) {
      // TODO: propagate interrupt instead?
      Thread.currentThread().interrupt();
    }
  }
198535
def on_mode_button(self, my_button, state):
        """"""
        if state:
            # The new mode is the label of the button
            self.controller.set_mode(my_button.get_label())
345946
def switch_state(context, ain):
    """"""
    context.obj.login()
    actor = context.obj.get_actor_by_ain(ain)
    if actor:
        click.echo("State for {} is: {}".format(ain,'ON' if actor.get_state() else 'OFF'))
    else:
        click.echo("Actor not found: {}".format(ain))
1232161
public void onChangeEditingState(GeometryEditChangeStateEvent event) {
		switch (event.getEditingState()) {
			case DRAGGING:
				mapPresenter.setCursor("move");
				break;
			case IDLE:
			default:
				mapPresenter.setCursor("default");
				redraw();
		}
	}
1126133
function (SRE,state) {
      var w = SRE.width, m = w, M = 1000000;
      for (var j = SRE.action.length-1; j >= 0; j--) {
        var action = SRE.action[j], selection = action.selection;
        if (w > SRE.cwidth) {
          action.selection = 1;
          m = action.SREwidth; M = w;
        } else {
          action.selection = 2;
        }
        w = action.SREwidth;
        if (SRE.DOMupdate) {
          document.getElementById(action.id).setAttribute("selection",action.selection);
        } else if (action.selection !== selection) {
          state.changed = true;
        }
      }
      SRE.m = m; SRE.M = M;
    }
792491
function(a) {
		gui.Spirit.prototype.onaction.call(this, a);
		this.action.$handleownaction = false;
		switch (a.type) {
			case gui.$ACTION_XFRAME_VISIBILITY:
				this._waiting = false;
				if (gui.hasModule("gui-layout@wunderbyte.com")) { // TODO: - fix
					if (a.data === true) {
						this.visibility.on();
					} else {
						this.visibility.off();
					}
				}
				a.consume();
				break;
		}
	}
296405
function (id, buttonState) {
    var changed;
    changed = this.handlePress(id, buttonState) |
              this.handleTouch(id, buttonState) |
              this.handleValue(id, buttonState);
    if (!changed) { return false; }
    this.el.emit(EVENTS.BUTTONCHANGED, this.buttonEventDetails[id], false);
    return true;
  }
911655
function(state) {
            if (state == this.state) return;

            this.state = state;
            logging.log("state ", this.state);
            this.trigger("state", this.state);
        }