opal-actioncable 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/lib/opal-actioncable.rb +4 -0
- data/lib/opal-actioncable/version.rb +5 -0
- data/opal-actioncable.gemspec +4 -4
- data/opal/{opal-actioncable → action_cable}/connection.rb +0 -0
- data/opal/{opal-actioncable → action_cable}/connection_monitor.rb +0 -0
- data/opal/{opal-actioncable → action_cable}/consumer.rb +0 -0
- data/opal/action_cable/subscription.rb +23 -0
- data/opal/{opal-actioncable → action_cable}/subscriptions.rb +1 -1
- data/opal/opal-actioncable.rb +9 -8
- metadata +14 -28
- data/lib/opal/actioncable.rb +0 -4
- data/lib/opal/actioncable/version.rb +0 -5
- data/opal/opal-actioncable/subscription.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f4d9fb8c98906c47ea42818fdcb3bbb44202edd
|
4
|
+
data.tar.gz: 72289fb9e794d34c007995829185ff8b35b1564d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a55b3b8263767ff0f8381bf4ba08eb41f2da135a383cb335254c41b52487cb99bfb127a38286cb7a0553e3d738b66dae758d63e445223772af27f23e7a508786
|
7
|
+
data.tar.gz: 093906b04ff3c1c1f089a51f154b02ed545cb2ffa92bc08b6cc34578e4793804d818b13f159b4d6d536761b8dc4a02a0e70f86a2911a3fe7dc11bc33caa24472
|
data/README.md
CHANGED
@@ -24,14 +24,15 @@ Or install it yourself as:
|
|
24
24
|
require 'opal-actioncable'
|
25
25
|
|
26
26
|
class TestChannel < ActionCable::Subscription
|
27
|
-
|
28
|
-
|
27
|
+
def connected
|
28
|
+
perform 'send', {data: 23}
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
def disconnected
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
def received data
|
35
|
+
end
|
35
36
|
end
|
36
37
|
|
37
38
|
consumer = ActionCable.createConsumer("/cable")
|
data/opal-actioncable.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'opal
|
4
|
+
require 'opal-actioncable/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "opal-actioncable"
|
8
|
-
spec.version = Opal::
|
8
|
+
spec.version = Opal::ActionCable::VERSION
|
9
9
|
spec.authors = ["Jose Añasco", "Michael Sprauer"]
|
10
10
|
spec.email = ["joseanasco1@gmail.com", "Michael@Sprauer.net"]
|
11
11
|
|
@@ -16,8 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
spec.bindir = "exe"
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
20
|
spec.require_paths = ["lib"]
|
20
21
|
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_dependency 'opal'
|
23
23
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class ActionCable::Subscription
|
2
|
+
include Native::Helpers
|
3
|
+
|
4
|
+
def initialize subscriptions, params
|
5
|
+
@native = `new ActionCable.Subscription(#{subscriptions}, #{params.to_n})`
|
6
|
+
%x{Opal.defn(self.$class(), 'perform', #{@native}.perform)}
|
7
|
+
|
8
|
+
self.class.instance_methods(false).each do |method_name|
|
9
|
+
next if method_name == :perform
|
10
|
+
%x{#{@native}[method_name] = function(){
|
11
|
+
if (arguments[0] !== null && typeof arguments[0] === 'object')
|
12
|
+
arguments[0] = $scope.get('Hash').$new(arguments[0])
|
13
|
+
#{self}["$" + #{method_name}].apply(self, arguments);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def perform action, data
|
20
|
+
`#{@native}.perform(action, data)`
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/opal/opal-actioncable.rb
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
|
2
|
-
require '
|
3
|
-
require 'opal-actioncable/connection_monitor'
|
4
|
-
require 'opal-actioncable/consumer'
|
5
|
-
require 'opal-actioncable/subscription'
|
6
|
-
require 'opal-actioncable/subscriptions'
|
2
|
+
require 'action_cable'
|
7
3
|
|
8
|
-
|
9
|
-
module ActionCable
|
4
|
+
class ActionCable
|
10
5
|
|
11
6
|
class << self
|
12
7
|
def create_consumer url
|
@@ -28,4 +23,10 @@ module ActionCable
|
|
28
23
|
@@default_consumer
|
29
24
|
end
|
30
25
|
end
|
31
|
-
end
|
26
|
+
end
|
27
|
+
|
28
|
+
require 'action_cable/connection'
|
29
|
+
require 'action_cable/connection_monitor'
|
30
|
+
require 'action_cable/consumer'
|
31
|
+
require 'action_cable/subscription'
|
32
|
+
require 'action_cable/subscriptions'
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Añasco
|
@@ -12,33 +12,19 @@ cert_chain: []
|
|
12
12
|
date: 2016-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: opal
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
21
|
-
type: :
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rake
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '10.0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '10.0'
|
27
|
+
version: '0'
|
42
28
|
description: Bring all the ActionCable goodness back to the ruby language
|
43
29
|
email:
|
44
30
|
- joseanasco1@gmail.com
|
@@ -54,15 +40,15 @@ files:
|
|
54
40
|
- Rakefile
|
55
41
|
- bin/console
|
56
42
|
- bin/setup
|
57
|
-
- lib/opal
|
58
|
-
- lib/opal
|
43
|
+
- lib/opal-actioncable.rb
|
44
|
+
- lib/opal-actioncable/version.rb
|
59
45
|
- opal-actioncable.gemspec
|
46
|
+
- opal/action_cable/connection.rb
|
47
|
+
- opal/action_cable/connection_monitor.rb
|
48
|
+
- opal/action_cable/consumer.rb
|
49
|
+
- opal/action_cable/subscription.rb
|
50
|
+
- opal/action_cable/subscriptions.rb
|
60
51
|
- opal/opal-actioncable.rb
|
61
|
-
- opal/opal-actioncable/connection.rb
|
62
|
-
- opal/opal-actioncable/connection_monitor.rb
|
63
|
-
- opal/opal-actioncable/consumer.rb
|
64
|
-
- opal/opal-actioncable/subscription.rb
|
65
|
-
- opal/opal-actioncable/subscriptions.rb
|
66
52
|
homepage: https://github.com/MichaelSp/opal-actioncable
|
67
53
|
licenses: []
|
68
54
|
metadata: {}
|
data/lib/opal/actioncable.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
class ActionCable::Subscription
|
2
|
-
include Native::Helpers
|
3
|
-
|
4
|
-
def initialize subscriptions, params
|
5
|
-
@native = `new ActionCable.Subscription(#{subscriptions}, #{params.to_n})`
|
6
|
-
%x{Opal.defn(self.$class(), 'perform', #{@native}.perform)}
|
7
|
-
end
|
8
|
-
|
9
|
-
def perform action, data
|
10
|
-
@native.perform action, data
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|