MCPcopy
hub / github.com/Robdel12/DropKick / _searchOptions

Method _searchOptions

src/dropkick.js:933–962  ·  view source on GitHub ↗

* @method searchOptions * @private

( event )

Source from the content-addressed store, hash-verified

931 * @private
932 */
933 _searchOptions( event ) {
934 var results,
935 self = this,
936 keyChar = String.fromCharCode( event.keyCode || event.which ),
937
938 waitToReset = function() {
939 if ( self.data.searchTimeout ) {
940 clearTimeout( self.data.searchTimeout );
941 }
942
943 self.data.searchTimeout = setTimeout(function() {
944 self.data.searchString = "";
945 }, 1000 );
946 };
947
948 if ( this.data.searchString === undefined ) {
949 this.data.searchString = "";
950 }
951
952 waitToReset();
953
954 this.data.searchString += keyChar;
955 results = this.search( this.data.searchString, this.data.settings.search );
956
957 if ( results.length ) {
958 if ( !_.hasClass( results[0], "dk-option-disabled" ) ) {
959 this.selectOne( results[0] );
960 }
961 }
962 }
963
964 /**
965 * @method scrollTo

Callers 1

handleEventMethod · 0.95

Calls 2

searchMethod · 0.95
selectOneMethod · 0.95

Tested by

no test coverage detected