diff options
| author | 2023-03-23 17:37:11 -0400 | |
|---|---|---|
| committer | 2023-03-23 17:37:11 -0400 | |
| commit | eae7f3e5dedc8b02cb8c59c0eee8bc0f1014955d (patch) | |
| tree | 7d0c5ba80ce0bc17770828841f9d44f122c56895 | |
| parent | native: add OO-like setopt and getopt (diff) | |
janet: add example of get/put interface in init
| -rw-r--r-- | jurl/init.janet | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/jurl/init.janet b/jurl/init.janet index a9dc959..d618814 100644 --- a/jurl/init.janet +++ b/jurl/init.janet @@ -26,12 +26,13 @@ # the latter being preferrable for anyone building their own wrapper # it's intended for relatively low level use, but still usable directly # the primary purpose is to allow options to be persisted +# the main disadvantage is you can no longer use get for getinfo and put for setopt (def Simple @{:type "JurlSimpleClient" # make sure to set: # :handle; output of native/new # :options; optional, same as *default-options* but client-specific - :getinfo |(:getinfo ($ :handle) $1) + :getinfo |(get ($ :handle) $1) :perform (fn [$ &opt opts] (when opts (apply-opts ($ :handle) opts)) (:perform ($ :handle)) @@ -42,7 +43,7 @@ $) :setopt (fn [$ k v] (put ($ :options) k v) - (:setopt ($ :handle) k v) + (put ($ :handle) k v) $)}) (defn new-simple |
