opal-actioncable 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d4f3001a76feac9771f1a5efc10583bb13fd1ca
4
- data.tar.gz: b770b1d29cd930346d21f334aa69d5d3a70b6ff3
3
+ metadata.gz: 0fc34998bd47586d7a3bffe08db36983123b4f60
4
+ data.tar.gz: f0e6423c4ca10c631f8b2904dc2d38b2a123e8e0
5
5
  SHA512:
6
- metadata.gz: eac55b8f222ca1fcf7fd38e92f2c50c05e12738bf2f9f0a4f6b7a9bcf72888f0ce61e8f60fd6579666db831347e240bd7b625dd15089a2355ba60eb86e6b35ec
7
- data.tar.gz: 896a55ba6a1eb4eb4b91bf295269caf2f2c248cb6c7ff6f4e2599d7e90917d03884a08281e7a97cd6c76a4d55723d8c91d88436b8b91e22d243b2425c8edefaf
6
+ metadata.gz: 435dc1da70f7ecd532c8035660c0752669a0c11507abeb19e36bd97b96ef9344f457efc91ffc1e3694475064de806e8ff6cdb97f17f7ab1712ae5f21c0748b01
7
+ data.tar.gz: 7ccb132faf40ff8e40c544f71be5a22ecd3e34a6b39cade165aef9f661437eef67c4786d98740449ae894589b72ed3bab00067935a26f0f88c4409926c24b811
data/README.md CHANGED
@@ -20,43 +20,50 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- # assets/javascript/application.rb
24
- require 'opal-actioncable'
23
+ ```ruby
24
+ # assets/javascript/application.rb
25
+ require 'opal-actioncable'
25
26
 
26
- class TestChannel < ActionCable::Subscription
27
- def connected
28
- perform 'send', {data: 23}
29
- end
27
+ class TestChannel < ActionCable::Subscription
28
+ def connected
29
+ perform 'send', {data: 23}
30
+ end
30
31
 
31
- def disconnected
32
- end
32
+ def disconnected
33
+ end
33
34
 
34
- def received data
35
- end
36
- end
35
+ def received data
36
+ end
37
+ end
37
38
 
38
- consumer = ActionCable.createConsumer
39
- consumer.subscriptions.create TestChannel
39
+ consumer = ActionCable.createConsumer
40
+ consumer.subscriptions.create TestChannel
40
41
 
41
- # or
42
+ # or
42
43
 
43
- ChatChannel = TestChannel
44
- consumer.subscriptions.create ChatChannel, {channel: 'Chat', room: 'default'}
44
+ ChatChannel = TestChannel
45
+ consumer.subscriptions.create ChatChannel, {channel: 'Chat', room: 'default'}
46
+ ```
45
47
 
46
48
  ### Skip client-side dispatching
47
-
49
+
48
50
  If you send your messages in the format `{action: ..., data: ...}`
49
-
50
- ActionCable.server.broadcast "channel", {action: 'action_name', data: {some: 'data'}}
51
-
51
+
52
+ ```ruby
53
+ ActionCable.server.broadcast "channel", {action: 'action_name', data: {some: 'data'}}
54
+ ```
55
+
52
56
  And if `action` and `data` are the only keys in your hash, you can catch it on client side like this:
53
-
54
- class TestChannel < ActionCable::Subscription
55
- def action_name params
56
- puts params # > {some: 'data'}
57
- end
58
- end
59
-
57
+
58
+ ```ruby
59
+ class TestChannel < ActionCable::Subscription
60
+ def action_name params
61
+ puts params # > {some: 'data'}
62
+ end
63
+ end
64
+ ```
65
+
66
+
60
67
  ## Development
61
68
 
62
69
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module ActionCable
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ class ActionCable::Connection
4
4
  def initialize consumer
5
5
  @native = `new ActionCable.Connection(#{consumer})`
6
6
  @subscriptions = consumer.subscriptions
7
- @monitor = ConnectionMonitor.new self
7
+ @monitor = ActionCable::ConnectionMonitor.new self
8
8
 
9
9
  %x{
10
10
  Opal.defn(self.$class(), 'send', function(){ return self.$delegate_native('send', arguments); });
@@ -19,7 +19,7 @@ class ActionCable::Connection
19
19
  Opal.defn(self.$class(), 'getState', function(){ return self.$delegate_native('getState', arguments); });
20
20
  Opal.defn(self.$class(), 'installEventHandlers', function(){ return self.$delegate_native('installEventHandlers', arguments); });
21
21
  Opal.defn(self.$class(), 'uninstallEventHandlers', function(){ return self.$delegate_native('uninstallEventHandlers', arguments); });
22
- }
22
+ }
23
23
  end
24
24
 
25
25
  def send data
@@ -32,4 +32,4 @@ class ActionCable::Connection
32
32
  end
33
33
 
34
34
 
35
- end
35
+ end
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'opal/actioncable'
3
+
4
+ require 'minitest/autorun'
@@ -0,0 +1,11 @@
1
+ require 'minitest_helper'
2
+
3
+ class TestOpal::Actioncable < Minitest::Test
4
+ def test_that_it_has_a_version_number
5
+ refute_nil ::Opal::Actioncable::VERSION
6
+ end
7
+
8
+ def test_it_does_something_useful
9
+ assert false
10
+ end
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-actioncable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Añasco
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-06-03 00:00:00.000000000 Z
12
+ date: 2017-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: opal
@@ -49,6 +49,8 @@ files:
49
49
  - opal/action_cable/subscription.rb
50
50
  - opal/action_cable/subscriptions.rb
51
51
  - opal/opal-actioncable.rb
52
+ - test/minitest_helper.rb
53
+ - test/test_opal/actioncable.rb
52
54
  homepage: https://github.com/MichaelSp/opal-actioncable
53
55
  licenses: []
54
56
  metadata: {}
@@ -68,8 +70,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
70
  version: '0'
69
71
  requirements: []
70
72
  rubyforge_project:
71
- rubygems_version: 2.4.5
73
+ rubygems_version: 2.6.8
72
74
  signing_key:
73
75
  specification_version: 4
74
76
  summary: ActionCable adapter for Opal
75
- test_files: []
77
+ test_files:
78
+ - test/minitest_helper.rb
79
+ - test/test_opal/actioncable.rb