saikyun / freja

Self-modifiable editor for coding graphical things
67 stars 3 forks source link

Examples doesn't work #65

Open saikyun opened 1 year ago

saikyun commented 1 year ago

Atm examples are old and don't work. Need to fix that.

sogaiu commented 1 year ago

The following code for clickable.janet seems to work [1] with main (068deb7a3ac1ce405443ebf889b9ed0a643c28e0) ATM:

(import freja/hiccup :as h)
(import freja/event/subscribe :as e)
(use freja/defonce)

(def props @{:label "Click me"})

(defn hiccup
  [props & _]
  [:padding {:left 600
             :top 30}
   [:background {:color :white}
    [:clickable
     {:on-click (fn [_]
                  (e/put! props :label
                          (string "Different label " (math/random))))}
     (props :label)]]])

(h/new-layer :pixel-editor
             hiccup
             props
             :text/size 22)

[1] Well, at least it doesn't crash and one can click on things with results :)

sogaiu commented 1 year ago

minimal-hiccup.janet seems to work for me as-is.