Resolve triggerEvent

This commit is contained in:
oguzhankoral
2023-07-17 15:17:21 +03:00
parent 29488a2d87
commit 91fab4dcd4
5 changed files with 9 additions and 7 deletions
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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