Run on complete and automatically unbind
480007
function then (callback) {
        if (typeof callback !== 'function') {
          throw new Error('Callback must be a function, instead got: ' + (typeof callback));
        }

        function thenCallback (result) {
          callback(result);
          unbind('end', thenCallback);
        }

        bind('end', thenCallback);
        bind('stop', unbind.bind(null, 'end', thenCallback));

        return self;
      }
467621
def unbind (self, event, callback):
        
        if self._events.has_key(event) and len(self._events[event]) > 0:
            for _callback in self._events[event]:
                if _callback == callback:
                    self._events[event].remove(callback)
                if len(self._events[event]) == 0:
                    del self._events[event]
59533
def switch_off(self):
        """"""
        success = self.set_status(CONST.STATUS_OFF_INT)

        if success:
            self._json_state['status'] = CONST.STATUS_CLOSED

        return success
1230905
def disable(self, everything=False):
        
        self.freeze()
        if not everything:
            self.xbin.enable()
            self.ybin.enable()
        self.frozen = False
1284369
function _unbindDragHandlers(_el) {
            if (!_el._katavorioDrag) return;
            if (prune || orphan) {
                _el._katavorioDrag.off(STOP, _pruneOrOrphan);
            }
            if (!prune && !orphan && revert) {
                _el._katavorioDrag.off(REVERT, _revalidate);
                _el._katavorioDrag.setRevert(null);
            }
        }
1331710
function () {
        var keys = [],
            bindings = getBindings(this);
        for (var k in bindings) {
            if (bindings.hasOwnProperty(k)) {
                this.unbind(k);
            }
        }
    }
572025
def set_unbind(self):
        
        IntegerEntry.set_unbind(self)
        self.unbind('<Button-1>')
        self.unbind('<Button-3>')
        self.unbind('<Up>')
        self.unbind('<Down>')
        self.unbind('<Enter>')
        self.unbind('<Next>')
        self.unbind('<Prior>')
20435
function onUnmount( instance ) {
  store.deleteInstance( instance );
  if ( store.isEmpty() ) {
    listeners.unbindClicks( _onClick );
    listeners.unbindKeys( _onKeyDown );
  }
}
847371
private void cleanup(boolean atStartup) {
        boolean allTasksIdle = false;
        while (!allTasksIdle) {
            int activeCount = 0;
            for (Task task: taskDao.listTasks()) {
                if (!task.getState().equals(Task.IDLE)) {
                    activeCount++;
                    if (!task.getState().equals(Task.CANCELING)) {
                        logger.info("Auto-canceling task " + task.getId() + " (" + task.getName() + ")");
                        taskDao.setTaskState(task.getId(), Task.CANCELING);
                        task.setState(Task.CANCELING);
                    }
                    if (atStartup) {
                        // We're cleaning up after an unclean shutdown.
                        // Since the TaskRunner isn't actually running, we make
                        // the direct call here to clean up the state in the
                        // database, marking it as canceled.
                        taskCanceled(task);
                    } else {
                        // In the normal case, the TaskRunner is running in a
                        // separate thread and we just need to request that
                        // it cancel at the next available opportunity.
                        cancelTask(task);
                    }
                }
            }
            if (activeCount == 0 || atStartup) {
                allTasksIdle = true;
            } else {
                logger.info("Waiting for " + activeCount + " task(s) to go idle.");
                sleepSeconds(1);
            }
        }
    }
435446
void unbind(String key)
    {
        NamedEntry entry = new NamedEntry(key, null, false);
        localUnbind(key);
        addForDeletion(entry);
    }
1279937
public void unbind(BaseUIComponent component) {
        if (componentBindings.remove(component)) {
            keyEventListener.registerComponent(component, false);
            CommandUtil.updateShortcuts(component, shortcutBindings, true);
            setCommandTarget(component, null);
        }
    }
618264
function(oldObserved, onchanged) {
            for (var name in oldObserved) {
                var obEv = oldObserved[name];
                obEv.obj.unbind(obEv.event, onchanged);
            }
        }
72724
void cancelEdit() {

        m_handler.enableToolbarButtons();
        m_handler.activateSelection();
        m_handler.m_controller.setContentEditing(false);
        m_handler.m_controller.reInitInlineEditing();
        m_replaceElement = null;
        m_dependingElementId = null;
        m_currentElementId = null;
        m_editorOpened = false;
    }
936100
def unbind(self, callback):
        
        handlers = self._handlers
        if handlers:
            filtered_callbacks = [f for f in handlers if f != callback]
            removed_count = len(handlers) - len(filtered_callbacks)
            if removed_count:
                self._handlers = filtered_callbacks
            return removed_count
        return 0
674096
function( eles ){
          for( var i = 0; i < eles.length; i++ ){
            eles[i]._private.grabbed = false;
            eles[i]._private.rscratch.inDragLayer = false;
            if( eles[i].active() ){ eles[i].unactivate(); }
          }
        }
850984
function off(input, state, keep) {
    var node = input[0],
      parent = input.parent(),
      checked = state == _checked,
      indeterminate = state == _indeterminate,
      disabled = state == _disabled,
      callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
      regular = option(input, callback + capitalize(node[_type])),
      specific = option(input, state + capitalize(node[_type]));

    // Prevent unnecessary actions
    if (node[state] !== false) {

      // Toggle state
      if (indeterminate || !keep || keep == 'force') {
        node[state] = false;
      };

      // Trigger callbacks
      callbacks(input, checked, callback, keep);
    };

    // Add proper cursor
    if (!node[_disabled] && !!option(input, _cursor, true)) {
      parent.find('.' + _iCheckHelper).css(_cursor, 'pointer');
    };

    // Remove state class
    parent[_remove](specific || option(input, state) || '');

    // Set ARIA attribute
    disabled ? parent.attr('aria-disabled', 'false') : parent.attr('aria-checked', 'false');

    // Add regular state class
    parent[_add](regular || option(input, callback) || '');
  }
377326
def unbind(self, format, *args):
        
        return lib.zsock_unbind(self._as_parameter_, format, *args)