潇洒的工作 get_event?
Dashing job get_event?
在我的仪表板中,我有一份工作,我想从我的小部件中获取一个值。
# :first_in sets how long it takes before the job is first run. In this case, it is run immediately
SCHEDULER.every '1s', :first_in => 0 do |job|
send_event('my_widget', { value: rand(400) })
end
这是将数据发送到我的小部件的代码,但我如何才能获取数据?我要查找的“get_event
”是什么?
来自 this issue in dashing github repository, You can use server sent events 从仪表板获取数据。
Dashing 提供来自相同 API 终点的数据
返回数据摘录
data: {"current":77,"last":82,"id":"valuation","updatedAt":1461840437}
data: {"current":104578,"last":89199,"id":"karma","updatedAt":1461840437}
data: {"value":62,"id":"synergy","updatedAt":1461840437}
在我的仪表板中,我有一份工作,我想从我的小部件中获取一个值。
# :first_in sets how long it takes before the job is first run. In this case, it is run immediately
SCHEDULER.every '1s', :first_in => 0 do |job|
send_event('my_widget', { value: rand(400) })
end
这是将数据发送到我的小部件的代码,但我如何才能获取数据?我要查找的“get_event
”是什么?
来自 this issue in dashing github repository, You can use server sent events 从仪表板获取数据。
Dashing 提供来自相同 API 终点的数据
返回数据摘录
data: {"current":77,"last":82,"id":"valuation","updatedAt":1461840437}
data: {"current":104578,"last":89199,"id":"karma","updatedAt":1461840437}
data: {"value":62,"id":"synergy","updatedAt":1461840437}