Set the callback function to consume on state changed events
        which are generated when the state of the machine changes.

        Callback receives a IStateChangeEvent object.

        Returns the callback_id
345163
def register_on_state_changed(self, callback):
        
        event_type = library.VBoxEventType.on_state_changed
        return self.event_source.register_callback(callback, event_type)
460212
def register_on_machine_data_changed(self, callback):
        
        event_type = library.VBoxEventType.on_machine_data_changed
        return self.event_source.register_callback(callback, event_type)
382101
def trigger(self, attr, old, new, hint=None, setter=None):
        ''' 

        '''
        def invoke():
            callbacks = self._callbacks.get(attr)
            if callbacks:
                for callback in callbacks:
                    callback(attr, old, new)
        if hasattr(self, '_document') and self._document is not None:
            self._document._notify_change(self, attr, old, new, hint, setter, invoke)
        else:
            invoke()
883721
def async_state_change_callback(self, addr, state, value):
        """"""
        _LOGGING.info('Device %s state %s value is changed to %s',
                      addr, state, value)
1212734
def trigger_all_change_callbacks(self):
        """"""
        return [
            ret
            for key in DatastoreLegacy.store[self.domain].keys()
            for ret in self.trigger_change_callbacks(key)
        ]
593122
def set_callback(self, ref, callback):
        
        # if the callback already exists, remove it
        self.remove_callback(ref)

        # add it to the callbacks
        if callback is not None:
            self._callbacks[ref] = callback
606778
def register_on_serial_port_changed(self, callback):
        
        event_type = library.VBoxEventType.on_serial_port_changed
        return self.event_source.register_callback(callback, event_type)
1195193
def callback(self, callback, *args, **kwds):
        
        return self << _CloseDummy(callback, args, kwds)
624435
public void dispatchConsumerSetChangeCallbackEvent(ConsumerSetChangeCallback consumerSetChangeCallback,boolean isEmpty)
   {
      if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchConsumerSetChangeCallbackEvent",
            new Object[]{consumerSetChangeCallback, isEmpty});

      //Create a new ConsumerSetChangeCallbackThread and dispatch it.
      final ConsumerSetChangeCallbackThread thread = new ConsumerSetChangeCallbackThread(consumerSetChangeCallback,isEmpty);
      dispatchThread(thread);

      if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchConsumerSetChangeCallbackEvent");
   }
510909
function connectComponentState(component, keys_to_watch_for_changes) {
    var additonal_callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;

    if (!Array.isArray(keys_to_watch_for_changes)) {
      throw keys_to_watch_for_changes + ' must be an array';
    }
    component.state = component.state || {}; // initialize if not set

    // call this function whenever the store changes
    function _callback(changed_keys) {
      if (intersection(keys_to_watch_for_changes, changed_keys).length) {
        // only update the state if a key we care about has changed
        var state_update_obj = {};
        keys_to_watch_for_changes.forEach(function (k) {
          return state_update_obj[k] = store._store[k];
        });
        this.setState(state_update_obj);

        // if some other custom callback is required by the component
        // call that function as well
        if (additonal_callback) {
          additonal_callback(changed_keys);
        }
      }
    }
    var callback_bound_to_component = _callback.bind(component);

    // add keys that map to the store's keys
    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
      for (var _iterator = keys_to_watch_for_changes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var k = _step.value;

        if (!store._store.hasOwnProperty(k)) {
          throw 'Store does not have key ' + k;
        }
        if (component.state.hasOwnProperty(k)) {
          console.warn('Overwriting existing state key ' + k);
        }
        component.state[k] = store._store[k];

        store._recordKeySubscriber(k, component.constructor.name);
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion && _iterator.return) {
          _iterator.return();
        }
      } finally {
        if (_didIteratorError) {
          throw _iteratorError;
        }
      }
    }

    return store.subscribe(callback_bound_to_component);
  }
742913
def state_change_handler(self, evt):
        """"""
        datapath = evt.datapath
        assert datapath is not None
        if datapath.id == self._querier.dpid:
            if evt.state == MAIN_DISPATCHER:
                self._querier.start_loop(datapath)
            elif evt.state == DEAD_DISPATCHER:
                self._querier.stop_loop()
149429
function _deliverAllChangeRecords() {
        var observers = observerCallbacks.slice();
        var anyWorkDone = false;
        for (var i = 0, l = observers.length; i < l; i++) {
            var observer = observers[i];
            if (_deliverChangeRecords(observer)) {
                anyWorkDone = true;
            }
        }
        return anyWorkDone;
    }
1158544
def on_change(self, *callbacks):
        ''' 

        '''
        for callback in callbacks:

            if callback in self._callbacks: continue

            _check_callback(callback, ('event',))

            self._callbacks[callback] = callback
588856
function _attachChangeAndDefaultFileEvent(form_id) {
        var _this = this;

        var elements = this._collection[form_id].getInputs();
        [].forEach.call(elements, function (form_control) {

            _this.__attachSingleChangeEvent(form_id, form_control);
            _this.__observeSingleValueChange(form_id, form_control);

            // set default file input value
            if (form_control.type === 'file' && form_control.hasAttribute('value')) {
                var url = form_control.getAttribute('value');
                if (url !== '') {
                    _this.setFileFromUrl(form_id, form_control.name, url);
                }
            }
        });
    }
1134841
def _copy_with_changed_callback(self, new_callback):
        '''  '''
        return PeriodicCallback(self._document, new_callback, self._period, self._id)
49787
def update_event(self, event, uid):
        
        ev_for_change = self.calendar.get(uid)
        ev_for_change.content = event
        ev_for_change.save()
1148533
def set_read_events_callback(self, call_back):
        
        logger.info("setting read event callback")
        callback_wrapper = ctypes.CFUNCTYPE(None, ctypes.c_void_p,
                                            ctypes.POINTER(snap7.snap7types.SrvEvent),
                                            ctypes.c_int)

        def wrapper(usrptr, pevent, size):
            """
            Wraps python function into a ctypes function

            :param usrptr: not used
            :param pevent: pointer to snap7 event struct
            :param size:
            :returns: should return an int
            """
            logger.info("callback event: " + self.event_text(pevent.contents))
            call_back(pevent.contents)
            return 0

        self._read_callback = callback_wrapper(wrapper)
        return self.library.Srv_SetReadEventsCallback(self.pointer,
                                                      self._read_callback)