How to use inherits - 10 common examples

To help you get started, we’ve selected a few inherits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpmn-io / bpmn-js / lib / features / modeling / behavior / EventBasedGatewayBehavior.js View on Github external
}, []);

    newShapeTargetsIncomingSequenceFlows.forEach(function(sequenceFlow) {
      if (sequenceFlow.source !== newShape) {
        modeling.removeConnection(sequenceFlow);
      }
    });
  });
}

EventBasedGatewayBehavior.$inject = [
  'eventBus',
  'modeling'
];

inherits(EventBasedGatewayBehavior, CommandInterceptor);



// helpers //////////////////////

function isSequenceFlow(connection) {
  return is(connection, 'bpmn:SequenceFlow');
}
github pouchdb / pouchdb / packages / node_modules / pouchdb-core / src / setup.js View on Github external
return new PouchAlt(name, opts);
    }

    opts = opts || {};

    if (name && typeof name === 'object') {
      opts = name;
      name = opts.name;
      delete opts.name;
    }

    opts = Object.assign({}, PouchAlt.__defaults, opts);
    PouchDB.call(this, name, opts);
  }

  inherits(PouchAlt, PouchDB);

  PouchAlt.preferredAdapters = PouchDB.preferredAdapters.slice();
  Object.keys(PouchDB).forEach(function (key) {
    if (!(key in PouchAlt)) {
      PouchAlt[key] = PouchDB[key];
    }
  });

  // make default options transitive
  // https://github.com/pouchdb/pouchdb/issues/5922
  PouchAlt.__defaults = Object.assign({}, this.__defaults, defaultOpts);

  return PouchAlt;
};
github bpmn-io / bpmn-js / lib / features / modeling / behavior / AdaptiveLabelPositioningBehavior.js View on Github external
newLabelMid = {
        x: elementTrbl.right + ELEMENT_LABEL_DISTANCE + label.width / 2,
        y: elementMid.y
      };

      break;
    }

    var delta = substract(newLabelMid, labelMid);

    modeling.moveShape(label, delta);
  }

}

inherits(AdaptiveLabelPositioningBehavior, CommandInterceptor);

AdaptiveLabelPositioningBehavior.$inject = [
  'eventBus',
  'modeling'
];


// helpers //////////////////////

/**
 * Return alignments which are taken by a boundary's host element
 *
 * @param {Shape} element
 *
 * @return {Array}
 */
github bptlab / chor-js / lib / features / rules / ChoreoRules.js View on Github external
} from 'bpmn-js/lib/util/ModelUtil';

import { getMessageShape } from '../../util/MessageUtil';

/**
 * Specific rules for choreographies. We have to override and replace BpmnRules and can not add
 * another RuleProvider. This is because BpmnRules is often directly called by other components
 * to evaluate rules which bypasses the EventBus.
 * @constructor
 * @param {Injector} injector
 */
export default function ChoreoRules(injector) {
  injector.invoke(BpmnRules, this);
}

inherits(ChoreoRules, BpmnRules);

ChoreoRules.$inject = [ 'injector' ];

/**
 * Unfortunately the rules they define in BpmnRules call local methods instead of prototype
 * methods, i.e., canConnect() instead of this.canConnect(). That means that we have to redefine
 * most rules as they would otherwise still call those local methods and not our overridden
 * versions.
 */
ChoreoRules.prototype.init = function() {
  let self = this;

  this.addRule('connection.create', function(context) {
    var source = context.source,
        target = context.target,
        hints = context.hints || {},
github bptlab / chor-js / lib / features / popup-menu / LinkCallChoreoPopupProvider.js View on Github external
/**
 * Provides a list of choreographies to link call choreographies to.
 * @constructor
 * @param {Injector} injector
 * @param {PopupMenu} popupMenu
 * @param {Modeling|ChoreoModeling} modeling
 * @param {ChoreoUtil} choreoUtil
 */
export default function LinkCallChoreoProvider(injector, popupMenu, modeling, choreoUtil) {
  injector.invoke(PopupMenuProvider, this);
  this._popupMenu = popupMenu;
  this._modeling = modeling;
  this._choreoUtil = choreoUtil;
}

inherits(LinkCallChoreoProvider, PopupMenuProvider);

LinkCallChoreoProvider.$inject = [
  'injector',
  'popupMenu',
  'modeling',
  'choreoUtil'
];

LinkCallChoreoProvider.prototype.getEntries = function(element) {
  if (is(element, 'bpmn:CallChoreography')) {
    const currentChoreo = this._choreoUtil.currentChoreography();
    const currentRef = element.businessObject.calledChoreographyRef;
    let items = this._choreoUtil.choreographies().filter(choreo => choreo.id !== currentChoreo.id).map(choreo => {
      const name = choreo.name || choreo.id;
      return {
        id: ('select-' + choreo.id),
github pouchdb / pouchdb / packages / sublevel-pouchdb / src / errors.js View on Github external
import inherits from 'inherits';

function NotFoundError(reason) {
  Error.call(this, reason);
}

function EncodingError(reason) {
  Error.call(this, reason);
}

inherits(NotFoundError, Error);
inherits(EncodingError, Error);

NotFoundError.prototype.notFound = true;
NotFoundError.prototype.status = 404;

export {
  NotFoundError,
  EncodingError
};
github knex / knex / src / util / make-client.js View on Github external
inherits(Client, ParentClient)

  function Formatter(client) {
    Formatter.super_.call(this, client)
  }
  inherits(Formatter, ParentClient.prototype.Formatter)

  function QueryBuilder(client) {
    QueryBuilder.super_.call(this, client)
  }
  inherits(QueryBuilder, ParentClient.prototype.QueryBuilder)

  function SchemaBuilder(client) {
    SchemaBuilder.super_.call(this, client)
  }
  inherits(SchemaBuilder, ParentClient.prototype.SchemaBuilder)

  function SchemaCompiler(client, builder) {
    SchemaCompiler.super_.call(this, client, builder)
  }
  inherits(SchemaCompiler, ParentClient.prototype.SchemaCompiler)

  function TableBuilder(client, method, tableName, fn) {
    TableBuilder.super_.call(this, client, method, tableName, fn)
  }
  inherits(TableBuilder, ParentClient.prototype.TableBuilder)

  function TableCompiler(client, tableBuilder) {
    TableCompiler.super_.call(this, client, tableBuilder)
  }
  inherits(TableCompiler, ParentClient.prototype.TableCompiler)
github bpmn-io / bpmn-js / lib / features / auto-resize / BpmnAutoResizeProvider.js View on Github external
import { forEach } from 'min-dash';

import AutoResizeProvider from 'diagram-js/lib/features/auto-resize/AutoResizeProvider';


/**
 * This module is a provider for automatically resizing parent BPMN elements
 */
export default function BpmnAutoResizeProvider(eventBus, modeling) {
  AutoResizeProvider.call(this, eventBus);

  this._modeling = modeling;
}

inherits(BpmnAutoResizeProvider, AutoResizeProvider);

BpmnAutoResizeProvider.$inject = [
  'eventBus',
  'modeling'
];


/**
 * Check if the given target can be expanded
 *
 * @param  {djs.model.Shape} target
 *
 * @return {boolean}
 */
BpmnAutoResizeProvider.prototype.canResize = function(elements, target) {
github bpmn-io / bpmn-js / lib / features / auto-resize / BpmnAutoResize.js View on Github external
/**
 * Sub class of the AutoResize module which implements a BPMN
 * specific resize function.
 */
export default function BpmnAutoResize(injector) {

  injector.invoke(AutoResize, this);
}

BpmnAutoResize.$inject = [
  'injector'
];

inherits(BpmnAutoResize, AutoResize);


/**
 * Resize shapes and lanes.
 *
 * @param {djs.model.Shape} target
 * @param {Bounds} newBounds
 * @param {Object} hints
 */
BpmnAutoResize.prototype.resize = function(target, newBounds, hints) {

  if (is(target, 'bpmn:Participant')) {
    this._modeling.resizeLane(target, newBounds, null, hints);
  } else {
    this._modeling.resizeShape(target, newBounds, null, hints);
  }
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / modeling / behavior / CreateZeebeBoundaryEventBehavior.js View on Github external
};
    }

    context.shape = elementFactory.createShape(boundaryEvent);

  }, true);
}


CreateZeebeBoundaryEventBehavior.$inject = [
  'eventBus',
  'elementFactory',
  'bpmnFactory'
];

inherits(CreateZeebeBoundaryEventBehavior, CommandInterceptor);

inherits

Browser-friendly inheritance fully compatible with standard node.js inherits()

ISC
Latest version published 5 years ago

Package Health Score

70 / 100
Full package analysis

Popular inherits functions