diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-08-18 15:49:51 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-08-18 15:49:51 +0200 |
commit | 6deb9f966eb9a280cc16428ba9324ffc15ea60a8 (patch) | |
tree | ec3574856544cad4766a6bb93905089d8086db0a /app/assets/javascripts | |
parent | 10ba09f5466fe3d34a5ed78202c35f4e4f9d30e6 (diff) |
Live timelines using ActionCable
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/api/accounts.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/api/accounts/lookup.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/api/follows.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/api/statuses.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/application.js | 1 | ||||
-rw-r--r-- | app/assets/javascripts/cable.js | 13 | ||||
-rw-r--r-- | app/assets/javascripts/channels/timeline.js | 13 | ||||
-rw-r--r-- | app/assets/javascripts/oauth/applications.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/profiler.coffee | 5 | ||||
-rw-r--r-- | app/assets/javascripts/settings.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/statuses.coffee | 3 |
11 files changed, 26 insertions, 27 deletions
diff --git a/app/assets/javascripts/api/accounts.coffee b/app/assets/javascripts/api/accounts.coffee deleted file mode 100644 index 24f83d18b..000000000 --- a/app/assets/javascripts/api/accounts.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/api/accounts/lookup.coffee b/app/assets/javascripts/api/accounts/lookup.coffee deleted file mode 100644 index 24f83d18b..000000000 --- a/app/assets/javascripts/api/accounts/lookup.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/api/follows.coffee b/app/assets/javascripts/api/follows.coffee deleted file mode 100644 index 24f83d18b..000000000 --- a/app/assets/javascripts/api/follows.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/api/statuses.coffee b/app/assets/javascripts/api/statuses.coffee deleted file mode 100644 index 24f83d18b..000000000 --- a/app/assets/javascripts/api/statuses.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e07c5a830..646c5aba4 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -12,5 +12,4 @@ // //= require jquery //= require jquery_ujs -//= require turbolinks //= require_tree . diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js new file mode 100644 index 000000000..71ee1e66d --- /dev/null +++ b/app/assets/javascripts/cable.js @@ -0,0 +1,13 @@ +// Action Cable provides the framework to deal with WebSockets in Rails. +// You can generate new channels where WebSocket features live using the rails generate channel command. +// +//= require action_cable +//= require_self +//= require_tree ./channels + +(function() { + this.App || (this.App = {}); + + App.cable = ActionCable.createConsumer(); + +}).call(this); diff --git a/app/assets/javascripts/channels/timeline.js b/app/assets/javascripts/channels/timeline.js new file mode 100644 index 000000000..ca7c50d12 --- /dev/null +++ b/app/assets/javascripts/channels/timeline.js @@ -0,0 +1,13 @@ +App.timeline = App.cable.subscriptions.create("TimelineChannel", { + connected: function() { + console.log('Connected'); + }, + + disconnected: function() { + console.log('Disconnected'); + }, + + received: function(data) { + console.log(JSON.parse(data.message)); + } +}); diff --git a/app/assets/javascripts/oauth/applications.coffee b/app/assets/javascripts/oauth/applications.coffee deleted file mode 100644 index 24f83d18b..000000000 --- a/app/assets/javascripts/oauth/applications.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/profiler.coffee b/app/assets/javascripts/profiler.coffee deleted file mode 100644 index 40dfd0af6..000000000 --- a/app/assets/javascripts/profiler.coffee +++ /dev/null @@ -1,5 +0,0 @@ -$ -> - $(document).on 'turbolinks:load', -> - unless typeof window.MiniProfiler == 'undefined' - window.MiniProfiler.init() - window.MiniProfiler.pageTransition() diff --git a/app/assets/javascripts/settings.coffee b/app/assets/javascripts/settings.coffee deleted file mode 100644 index 24f83d18b..000000000 --- a/app/assets/javascripts/settings.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/statuses.coffee b/app/assets/javascripts/statuses.coffee deleted file mode 100644 index 24f83d18b..000000000 --- a/app/assets/javascripts/statuses.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ |