live 0.10.0 → 0.11.0

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
  SHA256:
3
- metadata.gz: e77327d7651ba96f1312740085897ec0f53430957dacb2d99782d895bf663afc
4
- data.tar.gz: 4436c155cd68f013986e86da07af57af4238522fc18e8d9161720abe0d47d5ae
3
+ metadata.gz: 41876a4b4870415b70d8e5747dce78f8eeed867b524bad32b9a0146c56296f41
4
+ data.tar.gz: ba656166a150f8d5a2da0ce37bc358159eb082db4b6340ef751cc2ff3b9f00d1
5
5
  SHA512:
6
- metadata.gz: 3a8160a7a68a5cc3ca5d4a00c350cd3147ba583f839fe395f73c1956ae918b2b00b3316067c633a434cc4e13472588caf2ffe4ec5f5d2ba39dd70bdbf8adbf0f
7
- data.tar.gz: 0b623c52f0408c34eb09d16c5f3b25a609537fa55cb1771c92fa8092ab33baa31c8aeb3596150c014824a8a605b52c7b0630c5b2d80fea94e595d5d7935e53fd
6
+ metadata.gz: 39d76c89db7212a85596ef74630816a88107fc752ac8e932f76b43d5e2d943bbb4e631f4a78a44b7c9e4c6ef2095defce9c5d8da83f9334f171afe20d9a41ad6
7
+ data.tar.gz: 86484b279c0a6c16f4d46fe2220627ba35a74810413108377bf4f8002c84c95681bea4f1d7c760842b48bdc10e5c5c7cecdc9e3c7723700df3f415e51256d1f4
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/live/element.rb CHANGED
@@ -7,6 +7,9 @@ require 'json'
7
7
  require 'securerandom'
8
8
 
9
9
  module Live
10
+ class PageError < RuntimeError
11
+ end
12
+
10
13
  # Represents a single dynamic content area on the page.
11
14
  class Element
12
15
  def self.unique_id
@@ -66,8 +69,13 @@ module Live
66
69
  # @parameter method [Symbol] The name of the remote functio to invoke.
67
70
  # @parameter arguments [Array]
68
71
  def rpc(*arguments)
69
- # This update might not be sent right away. Therefore, mutable arguments may be serialized to JSON at a later time (or never). This could be a race condition:
70
- @page.updates.enqueue(arguments)
72
+ if @page
73
+ # This update might not be sent right away. Therefore, mutable arguments may be serialized to JSON at a later time (or never). This could be a race condition:
74
+ @page.updates.enqueue(arguments)
75
+ else
76
+ # This is a programming error, as it probably means the element is still part of the logic of the server side (e.g. async loop), but it is not bound to a page, so there is nothing to update/access/rpc.
77
+ raise PageError, "Element is not bound to a page, make sure to implement #close!"
78
+ end
71
79
  end
72
80
  end
73
81
  end
data/lib/live/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
6
  module Live
7
- VERSION = "0.10.0"
7
+ VERSION = "0.11.0"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: live
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file