code: function (element, candidates, opts) {
      var typeAhead = this;
      opts = opts || {};
  
      typeAhead.element = element;
  
      typeAhead.candidates = candidates || [];
  
      typeAhead.list = new TypeAheadList(typeAhead);
  
      this.minLength = opts.hasOwnProperty('minLength') ? opts.minLength : 3;
  
      typeAhead.limit = opts.hasOwnProperty('limit') ? opts.limit : 5;
  
      typeAhead.onMouseDown = opts.hasOwnProperty('onMouseDown') ? opts.onMouseDown : function(){};
  
      typeAhead.onKeyDown = opts.hasOwnProperty('onKeyDown') ? opts.onKeyDown : function(){};
  
      typeAhead.fulltext = opts.hasOwnProperty('fulltext') ? opts.fulltext : false;
  
      typeAhead.scrollable = opts.hasOwnProperty('scrollable') ? opts.scrollable : false;
  
      typeAhead.callback = opts.hasOwnProperty('callback') ? opts.callback : function(){};
  
      typeAhead.query = '';
  
      typeAhead.selected = null;
  
      typeAhead.list.draw();
  
      typeAhead.element.addEventListener('keyup', function (event) {
          typeAhead.handleKeyUp.call(typeAhead, event.keyCode);
      }, false);
  
      typeAhead.element.addEventListener('keydown', function (event) {
          typeAhead.handleKeyDown.call(typeAhead, event.keyCode) && event.preventDefault();
      });
  
      typeAhead.element.addEventListener('focus', function () {
          typeAhead.handleFocus.call(typeAhead);
      });
  
      typeAhead.element.addEventListener('blur', function () {
          typeAhead.handleBlur.call(typeAhead);
      });
  
      typeAhead.update = function(candidates){
        this.candidates = candidates;
        typeAhead.handleKeyUp.call(typeAhead);
      }
  
      return typeAhead;
  }
docs: TypeAhead
  
  @constructor
  @param {HTMLInputElement} element
  @param {Array} candidates