Sha256: c58eec371bddb3791aeb3bfa95c8dbb3120882d8c8453c7c340b54e6d41ac7a5

Contents?: true

Size: 360 Bytes

Versions: 5

Compression:

Stored size: 360 Bytes

Contents

var realtime_host = "<%= QuickSearch::Engine::APP_CONFIG['realtime_url'] %>";

var socket = io.connect(realtime_host);
socket.emit('subscribe', {room: 'quicksearch-<%= Rails.env %>'});

socket.on('update', function(data){
  console.log(data);
  if ('q' in data) {
    var item = '<li>' + data.q + "</li>";
    $('#realtime_searches ul').prepend(item);
  }
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
quick_search-core-0.2.0 app/assets/javascripts/quick_search/realtime.js.erb
quick_search-core-0.1.1 app/assets/javascripts/quick_search/realtime.js.erb
quick_search-core-0.1.0 app/assets/javascripts/quick_search/realtime.js.erb
quick_search-core-0.0.1 app/assets/javascripts/quick_search/realtime.js.erb
quick_search-core-0.0.1.test app/assets/javascripts/quick_search/realtime.js.erb