diff options
| author | 2023-03-23 14:33:16 -0400 | |
|---|---|---|
| committer | 2023-03-23 14:33:16 -0400 | |
| commit | 0a13b46e0b6346ec6dafcb6bbe12efabf82bd4a6 (patch) | |
| tree | fac70ea70d33facee12488b2a38e80ef4e11e75f | |
| parent | native: add escape/unescape (diff) | |
jurl: move to subdir
| -rw-r--r-- | jurl/init.janet (renamed from jurl.janet) | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/jurl.janet b/jurl/init.janet index a44480f..7283987 100644 --- a/jurl.janet +++ b/jurl/init.janet @@ -27,22 +27,23 @@ # it's intended for relatively low level use, but still usable directly # the primary purpose is to allow options to be persisted (def Simple @{:type "JurlSimpleClient" - :handle nil # don't forget to populate - :options nil # don't forget to populate - - :getinfo |(:getinfo ($ :handle) $1) - :perform (fn [s &opt opts] - (when opts (apply-opts (s :handle) opts)) - (:perform (s :handle)) - s) - :reset (fn [s] - (:reset (s :handle)) - (apply-opts (s :handle) (merge *default-options* (s :options))) - s) - :setopt (fn [s k v] - (put (s :options) k v) - (:setopt (s :handle) k v) - s)}) + # make sure to set: + # :handle; output of jurl-native/new + # :options; optional, same as *default-options* but client-specific + + :getinfo |(:getinfo ($ :handle) $1) + :perform (fn [$ &opt opts] + (when opts (apply-opts ($ :handle) opts)) + (:perform ($ :handle)) + $) + :reset (fn [$] + (:reset ($ :handle)) + (apply-opts ($ :handle) (merge *default-options* ($ :options))) + $) + :setopt (fn [$ k v] + (put ($ :options) k v) + (:setopt ($ :handle) k v) + $)}) (defn new-simple [&opt opts &named handle] |
