From 91fab4dcd4b11d54c09445fa4ed26f5bc03e0dfd Mon Sep 17 00:00:00 2001 From: oguzhankoral Date: Mon, 17 Jul 2023 15:17:21 +0300 Subject: [PATCH] Resolve triggerEvent --- .../src/actions/test_actions/get_complex_type.rb | 2 +- speckle_connector/src/actions/test_actions/go_away.rb | 2 +- speckle_connector/src/actions/test_actions/say_hi.rb | 2 +- .../src/actions/test_actions/trigger_event.rb | 8 +++++--- speckle_connector/src/ui/test_bindings_view.rb | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/speckle_connector/src/actions/test_actions/get_complex_type.rb b/speckle_connector/src/actions/test_actions/get_complex_type.rb index d218a85..5211db5 100644 --- a/speckle_connector/src/actions/test_actions/get_complex_type.rb +++ b/speckle_connector/src/actions/test_actions/get_complex_type.rb @@ -13,7 +13,7 @@ module SpeckleConnector id: 'complex_type_id', count: 3 } - js_script = "testBindings.receiveResponse('#{resolve_id}', #{complex_type.to_json})" + js_script = "testBinding.receiveResponse('#{resolve_id}', #{complex_type.to_json})" state.with_add_queue_js_command('getComplexType', js_script) end end diff --git a/speckle_connector/src/actions/test_actions/go_away.rb b/speckle_connector/src/actions/test_actions/go_away.rb index a650729..5ecf217 100644 --- a/speckle_connector/src/actions/test_actions/go_away.rb +++ b/speckle_connector/src/actions/test_actions/go_away.rb @@ -10,7 +10,7 @@ module SpeckleConnector # @return [States::State] the new updated state object def self.update_state(state, resolve_id) puts 'SketchUp went away :(' - js_script = "testBindings.receiveResponse('#{resolve_id}')" + js_script = "testBinding.receiveResponse('#{resolve_id}')" state.with_add_queue_js_command('goAway', js_script) end end diff --git a/speckle_connector/src/actions/test_actions/say_hi.rb b/speckle_connector/src/actions/test_actions/say_hi.rb index 12c24fd..23dd9f1 100644 --- a/speckle_connector/src/actions/test_actions/say_hi.rb +++ b/speckle_connector/src/actions/test_actions/say_hi.rb @@ -13,7 +13,7 @@ module SpeckleConnector count.times do said_hi.append("#{say_hello_not_hi ? 'Hello' : 'Hi'} #{name}!") end - js_script = "testBindings.receiveResponse('#{resolve_id}', #{said_hi})" + js_script = "testBinding.receiveResponse('#{resolve_id}', #{said_hi})" state.with_add_queue_js_command('sayHi', js_script) end end diff --git a/speckle_connector/src/actions/test_actions/trigger_event.rb b/speckle_connector/src/actions/test_actions/trigger_event.rb index aad0ceb..2ed21b8 100644 --- a/speckle_connector/src/actions/test_actions/trigger_event.rb +++ b/speckle_connector/src/actions/test_actions/trigger_event.rb @@ -8,17 +8,19 @@ module SpeckleConnector class TriggerEvent < Action # @param state [States::State] the current state of the {App::SpeckleConnectorApp} # @return [States::State] the new updated state object - def self.update_state(state, _resolve_id, event_name) + def self.update_state(state, resolve_id, event_name) if event_name == 'emptyTestEvent' - js_script = "testBindings.emit('#{event_name}')" + js_script = "testBinding.emit('#{event_name}')" else args = { name: 'Oguzhan', isOk: true, count: 3 } - js_script = "testBindings.emit('#{event_name}', #{args.to_json})" + js_script = "testBinding.emit('#{event_name}', #{args.to_json})" end + resolve_js_script = "testBinding.receiveResponse('#{resolve_id}')" + state = state.with_add_queue_js_command('triggerEventResolve', resolve_js_script) state.with_add_queue_js_command('triggerEvent', js_script) end end diff --git a/speckle_connector/src/ui/test_bindings_view.rb b/speckle_connector/src/ui/test_bindings_view.rb index 8dc0016..838f7e3 100644 --- a/speckle_connector/src/ui/test_bindings_view.rb +++ b/speckle_connector/src/ui/test_bindings_view.rb @@ -11,7 +11,7 @@ require_relative '../actions/test_actions/trigger_event' module SpeckleConnector module Ui - TEST_BINDINGS_VIEW = 'testBindings' + TEST_BINDINGS_VIEW = 'testBinding' # View that provided by vue.js class TestBindingsView < View