Search code examples
om

Including Om Next source


I want to put debugging messages into the Om Next source. So I am wanting to include it in my own project which uses the Om Next library.

Mine and Om Next are the two sources. I have put them together (i.e. copied the Om Next namespaces across) into the same Lein project and commented out the Om Next library from the project.clj: [org.omcljs/om "1.0.0-alpha21"]

This must be a naive approach, because when trying to run the resultant project I get the error message: Uncaught TypeError: Cannot read property 'call' of undefined, which comes from this line in my source:

(def person (om/factory Person {:keyfn :name}))

How can I get past this error message? Or more generally - how to work with Om Next so debugging messages can be put in the source?

Another way to achieve this would be to be building my own version of the Om Next source. Not too difficult to put debugging messages into the library and then build and install it. A bit inconvenient though.


Solution

  • Look into the script folder.

    1. Running the figwheel.clj script (e.g. lein trampoline run -m clojure.main script/figwheel.clj) will build the Devcards examples. Simply point your browser to localhost:3449/devcards/index.html to view them.

    2. To run Om Next's tests (in the node REPL), at the moment you'll need to do the following:

      a) run the repl.clj script (e.g. lein trampoline run -m clojure.main script/repl.clj)

      b) in the REPL:

      i) (require '[om.next.tests])

      ii) (in-ns 'om.next.tests)

      iii) (run-tests)

    EDIT: since this commit it is now possible to run the tests via bin/test at the command line. Not deleting the above information since it is still a valid, alternative way to run the tests.