GenieFramework / Stipple.jl

The reactive UI library for interactive data applications with pure Julia.
MIT License
324 stars 27 forks source link

add prettyprinting of models #256

Closed hhaensel closed 10 months ago

hhaensel commented 10 months ago

model printing is currently not easy to understand at the REPL, Garish.pprint doesn't improve the situation a lot This PR implements automatic prettyprinting at the REPL:

julia> @app begin
         @out non_reactive a_::Int = 12
         @out s_ = "Hello"
         @out f = jsfunction"console.log('Hi')"
       end
__GF_AUTO_HANDLERS__ (generic function with 1 method)

julia> @init
Instance of 'Main_ReactiveModel'
    channel_ (internal): JUURVSVWBPYQFUNBDYIEDYVCFGCTUEFG
    channel__ (internal): JUURVSVWBPYQFUNBDYIEDYVCFGCTUEFG
    modes__ (internal): LittleDict(:a_ => 4)
    isready (autofield, in): false
    isprocessing (autofield, out): false
    fileuploads (autofield, in): Dict{AbstractString, AbstractString}()

    a_ (out, non-reactive): 12
    s_ (out): Hello
    f (out): Dict{Symbol, Any}(:jsfunction => Dict{Symbol, Any}(:body => "console.log('Hi')", :arguments => ""))