2015-07-22 15:17:25 +02:00
|
|
|
require 'opal'
|
|
|
|
require 'opal-jquery'
|
2015-07-22 22:08:36 +02:00
|
|
|
require "opal/parser"
|
2015-07-22 15:17:25 +02:00
|
|
|
require "json"
|
|
|
|
require 'opal-react'
|
|
|
|
|
2015-07-22 22:08:36 +02:00
|
|
|
require "salama"
|
2015-07-22 15:22:54 +02:00
|
|
|
require "class_view"
|
|
|
|
require "register_view"
|
|
|
|
require "source_view"
|
2015-07-22 21:05:31 +02:00
|
|
|
require "block_view"
|
2015-07-23 12:15:26 +02:00
|
|
|
require "interpreter"
|
2015-07-22 15:17:25 +02:00
|
|
|
|
2015-07-22 22:08:36 +02:00
|
|
|
Virtual.machine.boot
|
|
|
|
|
2015-07-22 15:22:54 +02:00
|
|
|
Document.ready? do # Document.ready? is a opal-jquery method.
|
2015-07-22 15:17:25 +02:00
|
|
|
React.render( React.create_element( Debugger), Element['#content'] )
|
|
|
|
end
|
|
|
|
|
|
|
|
class Debugger
|
|
|
|
|
|
|
|
include React::Component
|
|
|
|
# required_param :url
|
2015-07-22 21:05:31 +02:00
|
|
|
# define_state sources: JSON.from_object(`window.initial_sources`)
|
2015-07-22 15:17:25 +02:00
|
|
|
|
|
|
|
# before_mount do
|
|
|
|
# HTTP.get(url) do |response|
|
|
|
|
# if response.ok?
|
|
|
|
# sources! JSON.parse(response.body)
|
|
|
|
# else
|
|
|
|
# puts "failed with status #{response.status_code}"
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
# end
|
2015-07-23 12:15:26 +02:00
|
|
|
def initialize
|
|
|
|
@interpreter = Interpreter.new
|
|
|
|
end
|
2015-07-22 15:17:25 +02:00
|
|
|
|
|
|
|
def render
|
2015-07-23 12:15:26 +02:00
|
|
|
div.container do
|
|
|
|
div.row do
|
|
|
|
div.col_md_1 do
|
2015-07-22 22:08:36 +02:00
|
|
|
ClassView classes: Virtual.machine.space.classes
|
2015-07-22 21:05:31 +02:00
|
|
|
end
|
2015-07-23 12:15:26 +02:00
|
|
|
div.col_md_11 do
|
|
|
|
div.row do
|
|
|
|
div.col_md_4 do
|
2015-07-22 22:08:36 +02:00
|
|
|
"Future one"
|
|
|
|
end
|
2015-07-23 12:15:26 +02:00
|
|
|
div.col_md_4 do
|
2015-07-22 22:08:36 +02:00
|
|
|
"Future two"
|
|
|
|
end
|
2015-07-23 12:15:26 +02:00
|
|
|
div.col_md_4 do
|
2015-07-22 22:08:36 +02:00
|
|
|
BlockView block: [ "block 1" , "block 2"]
|
|
|
|
end
|
|
|
|
end
|
2015-07-23 12:15:26 +02:00
|
|
|
RegisterView registers: @interpreter.registers
|
2015-07-22 21:05:31 +02:00
|
|
|
end
|
|
|
|
end
|
2015-07-22 15:17:25 +02:00
|
|
|
end
|
2015-07-22 22:08:36 +02:00
|
|
|
|
2015-07-22 15:17:25 +02:00
|
|
|
end
|
|
|
|
end
|