How to use the basis.dom.event.addHandler function in basis

To help you get started, we’ve selected a few basis 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 basisjs / basisjs / src / basis / router.js View on Github external
function start(){
    if (!started)
    {
      // start watch for hash changes
      if (eventSupport)
        eventUtils.addHandler(global, 'hashchange', checkUrl);
      else
        timer = setInterval(checkUrl, CHECK_INTERVAL);

      /** @cut */ if (module.exports.debug)
      /** @cut */   basis.dev.log(namespace + ' started');

      // mark as started and check current hash
      started = true;
      checkUrl();
    }
  }
github smelukov / webpack-runtime-analyzer / src / ui / src / pages / fileMap / index.js View on Github external
}, this);
    },
    stop: function() {
        // dummy
    }
});

watcher.link(page, function(dataObject) {
    if (this.treemap && this.opened.value) {
        this.treemap.set('dataObject', dataObject);
    }
});

var resizeTimeout;

addHandler(window, 'resize', function() {
    clearTimeout(resizeTimeout);
    resizeTimeout = setTimeout(this.resizeMap.bind(this), 300);
}, page);

module.exports = page;
github basisjs / basisjs / src / basis / dom.js View on Github external
if (arguments.length > 1)
      handleInsert(element, createFragment.apply(0, basis.array.flatten(arrayFrom(arguments, 1))));

    // attach event handlers
    if (isConfig)
    {
      if (config.css)
      {
        if (!cssom)
          cssom = require('basis.cssom');
        cssom.setStyle(element, config.css);
      }

      for (var event in config)
        if (typeof config[event] == 'function')
          eventUtils.addHandler(element, event, config[event], element);
    }

    // return an element
    return element;
  }
github basisjs / basisjs / src / basis / ui / scroller.js View on Github external
addTargetElementHandlers: function(){
      Event.addHandler(this.targetElement, 'mousedown', this.onMouseDown, this);
      Event.addHandler(this.targetElement, 'touchstart', this.onMouseDown, this);
    },
    removeTargetElementHandlers: function(){
github basisjs / basisjs / src / devpanel / inspector / heatmap.js View on Github external
function startInspect(){
  if (!inspectMode.value)
  {
    updateOnScroll();
    inspectMode.set(true);
    highlight();

    domEventUtils.addGlobalHandler('scroll', updateOnScroll);
    domEventUtils.addHandler(window, 'resize', updateOnResize);
    inspectBasisEvent.captureEvent('contextmenu', endInspect);

    if (observer)
      observer.observe(document.body, {
        subtree: true,
        attributes: true,
        characterData: true,
        childList: true
      });
  }
}
github basisjs / basisjs / src / basis / ui / scroller.js View on Github external
addTargetElementHandlers: function(){
      Event.addHandler(this.targetElement, 'mousedown', this.onMouseDown, this);
      Event.addHandler(this.targetElement, 'touchstart', this.onMouseDown, this);
    },
    removeTargetElementHandlers: function(){
github basisjs / basisjs / src / basis / net / upload.js View on Github external
emit_start: function(request){
        eventUtils.addHandler(request.xhr.upload, 'progress', REQUEST_PROGRESS_HANDLER, request);
        AjaxTransport.prototype.emit_start.call(this, request);
      },
      emit_complete: function(request){
github basisjs / basisjs / src / basis / dragdrop.js View on Github external
setElement: function(element, trigger){
      this.element = resolveElement(element);
      trigger = resolveElement(trigger) || this.element;

      if (this.trigger !== trigger)
      {
        if (this.trigger)
          eventUtils.removeHandler(this.trigger, 'mousedown', startDrag, this);

        this.trigger = trigger;

        if (this.trigger)
          eventUtils.addHandler(this.trigger, 'mousedown', startDrag, this);
      }
    },
    setBase: function(baseElement){
github basisjs / basisjs / src / devpanel / inspector / common / overlay.js View on Github external
function startWatch(){
  eventUtils.addGlobalHandler('scroll', updateOnScroll);
  eventUtils.addGlobalHandler('mousemove', update);
  eventUtils.addGlobalHandler('pointermove', update);
  eventUtils.addGlobalHandler('focus', update);
  eventUtils.addGlobalHandler('focusIn', update);
  eventUtils.addGlobalHandler('focusOut', update);
  eventUtils.addGlobalHandler('blur', update);
  eventUtils.addHandler(global, 'resize', updateOnResize);
  inspectBasisEvent.captureEvent('contextmenu', function(){
    activeOverlay.set();
  });

  if (observer)
    observer.observe(document.body, {
      subtree: true,
      attributes: true,
      characterData: true,
      childList: true
    });
}