Skip to content

Commit 4f49f40

Browse files
committed
hyper-trace working
1 parent f3811c1 commit 4f49f40

File tree

15 files changed

+51
-74
lines changed

15 files changed

+51
-74
lines changed

ruby/examples/misc/stock-tickers/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ gem 'hyper-component', path: '../../../hyper-component'
4343
gem 'hyper-state', path: '../../../hyper-state'
4444
gem 'hyperstack-config', path: '../../../hyperstack-config'
4545
gem 'hyper-spec', path: '../../../hyper-spec'
46+
gem 'hyper-trace', path: '../../../hyper-trace'
4647
# gem 'hyperloop'
4748
#gem 'hyper-operation'
4849
gem 'opal-rails' #, '~> 0.9.4'

ruby/examples/misc/stock-tickers/Gemfile.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ PATH
3636
hyperstack-config (= 0.1)
3737
opal (>= 0.11.0, < 0.12.0)
3838

39+
PATH
40+
remote: ../../../hyper-trace
41+
specs:
42+
hyper-trace (0.1.0)
43+
hyperstack-config (= 0.1.0)
44+
3945
PATH
4046
remote: ../../../hyperstack-config
4147
specs:
@@ -355,6 +361,7 @@ DEPENDENCIES
355361
hyper-component!
356362
hyper-spec!
357363
hyper-state!
364+
hyper-trace!
358365
hyperstack-config!
359366
jbuilder (~> 2.5)
360367
listen (>= 3.0.5, < 3.2)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class HyperComponent
22
include Hyperstack::Component
33
include Hyperstack::State::Observable
4-
end
4+
end.hypertrace instrument: :all

ruby/examples/misc/stock-tickers/app/hyperstack/stores/stock_ticker.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def fetch
1818
HTTP.get("https://api.iextrading.com/1.0/stock/#{@symbol}/delayed-quote")
1919
.then do |resp|
2020
mutate @status = :success, @price = resp.json[:delayedPrice],
21-
@time = Time.at(resp.json[:delayedPriceTime] / 1000)
21+
@time = Time.at(resp.json[:delayedPriceTime] / 1000),
22+
@update_time = Time.now
2223
after(@update_interval) { fetch }
2324
end
2425
.fail do |resp|
@@ -35,3 +36,4 @@ def fetch
3536
puts "cancelling #{@symbol} ticker"
3637
end
3738
end
39+
StockTicker.hypertrace instrument: :all

ruby/hyper-component/lib/hyperstack/internal/component/instance_methods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def dom_node
3232
end
3333

3434
def mounted?
35-
`(#{self}.is_mounted === undefined) ? false : #{self}.is_mounted`
35+
`(#{self}.__hyperstack_component_is_mounted === undefined) ? false : #{self}.__hyperstack_component_is_mounted`
3636
end
3737

3838
def force_update!

ruby/hyper-component/lib/hyperstack/internal/component/react_wrapper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class extends React.Component {
103103
}
104104
}
105105
componentDidMount() {
106-
this.__opalInstance.is_mounted = true
106+
this.__opalInstance.__hyperstack_component_is_mounted = true
107107
if (#{type.method_defined? :component_did_mount}) {
108108
this.__opalInstanceSyncSetState = false;
109109
this.__opalInstance.$component_did_mount();
@@ -139,7 +139,7 @@ class extends React.Component {
139139
this.__opalInstanceSyncSetState = false;
140140
this.__opalInstance.$component_will_unmount();
141141
}
142-
this.__opalInstance.is_mounted = false;
142+
this.__opalInstance.__hyperstack_component_is_mounted = false;
143143
}
144144
145145
render() {
@@ -285,7 +285,7 @@ def self.convert_props(args)
285285
}
286286
}
287287
}
288-
288+
289289
elsif Hyperstack::Component::ReactAPI::HASH_ATTRIBUTES.include?(key) && value.is_a?(Hash)
290290
value.each { |k, v| props["#{key}-#{k.gsub(/__|_/, '__' => '_', '_' => '-')}"] = v.to_n }
291291
else

ruby/hyper-trace/DOCS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HyperTrace
22

3-
Method tracing and conditional break points for [Opal](http://opalrb.org/) and [Hyperloop](http://ruby-hyperloop.io) debug.
3+
Method tracing and conditional break points for [Opal](http://opalrb.org/) and [Hyperstack](http://hyperstack.org) debug.
44

55
Typically you are going to use this in Capybara or Opal-RSpec examples that you are debugging.
66

ruby/hyper-trace/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source 'https://rubygems.org'
2-
gem 'hyperloop-config', path: '../hyperloop-config'
2+
gem 'hyperstack-config', path: '../hyperloop-config'
33
# Specify your gem's dependencies in hyper-trace.gemspec
44
gemspec

ruby/hyper-trace/bin/console

Lines changed: 0 additions & 14 deletions
This file was deleted.

ruby/hyper-trace/bin/setup

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)