Skip to content

Commit

Permalink
Namespaced open? options
Browse files Browse the repository at this point in the history
To avoid future namespace pollution with statecharts
  • Loading branch information
ingesolvoll committed Nov 19, 2021
1 parent de7375c commit 61b66d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Here's an example:

```clojure
(def open-validation-fsm
^{:open? true}
^{::rs/open? true}
{:id :validation-open
:initial ::clean
:states {::clean {:on {::edit-started ::editing}}
Expand Down
5 changes: 3 additions & 2 deletions src/re_statecharts/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@
(defn integrate
([machine]
(integrate machine sc.rf/default-opts))
([{:keys [id] :as machine} {:keys [clock] :as opts}]
([{:keys [id] :as machine}
{::keys [open?]
:keys [clock] :as opts}]
(let [clock (or clock (clock/wall-clock))
open? (:open? opts)
machine (assoc machine :scheduler (Scheduler. id (atom {}) clock open?))
transition-opts (cond-> (:transition-opts opts)
open? (assoc :ignore-uknown-events? true))]
Expand Down

0 comments on commit 61b66d4

Please sign in to comment.