How to use the lazy.js.noop function in lazy

To help you get started, we’ve selected a few lazy 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 slap-editor / slap / lib / ui / BaseElement.js View on Github external
BaseElement.prototype._initHandlers = function () {
  var self = this;
  self.on('focus', function () {
    logger.debug('focus', util.typeOf(self));
    if (!self.focusable) self.focusNext();
  });
  self.on('blur', function () { logger.debug('blur', util.typeOf(self)); });
  self.on('show', function () { self.setFront(); });
  self.on('keypress', _.noop); // 'element keypress' doesn't work correctly without this
  self.on('element keypress', function (el, ch, key) {
    switch (util.getBinding(self.options.bindings, key)) {
      case 'hide': self.hide(); return false;
      case 'focusNext': self.focusNext(); return false;
      case 'focusPrev': self.focusPrev(); return false;
    }
  });
};
github slap-editor / slap / lib / ui / BaseModal.js View on Github external
.filter(function (child) { return child instanceof BaseModal; })
    .without(self);

  self.on('element blur', function () {
    if (!self.screen.focused.hasAncestor(self) && self.screen.focused !== self) self.hide();
  });

  self.on('click', function () {
    process.nextTick(function () {
      // TODO: don't change focus if contained element has focus already
      var firstChild = self.children[0];
      if (firstChild) firstChild.focus();
    });
  });

  self.on('keypress', _.noop); // 'element keypress' doesn't work correctly without this
  self.on('element keypress', function (el, ch, key) {
    switch (util.getBinding(self.options.bindings, key)) {
      case 'hide': self.hide(); break;
      case 'focusNext': self.focusEl(1); break;
      case 'focusPrev': self.focusEl(-1); break;
    }
  });
  self.on('show', function () {
    self.otherModals.invoke('hide');
    // if (self.otherModals.pluck('visible').compact().none()) self.screen.saveFocus();
    process.nextTick(function () { self.parent.render(); });
  });
  self.on('hide', function () {
    if (self.otherModals.pluck('visible').compact().none()) {
      self.parent.lockKeys = true; process.nextTick(function () { self.parent.lockKeys = false; }); // FIXME: ugly hack to stop enter from last event from propagating to editor

lazy

Lazy lists for node

MIT
Latest version published 12 years ago

Package Health Score

67 / 100
Full package analysis