Domanda

Since cljs doesnt have a format function, I need to define one myself

if i have a src file with following:

(ns formatter
  (:require [goog.string :as gstring]
            [goog.string.format]))

(defn format
  "Formats a string using goog.string.format."
  [fmt & args]
  (apply gstring/format fmt args))

how do I make format function available in all my src files?

È stato utile?

Soluzione

You probably should include the namespace and function in each file where you use it, I don't think any other solution would be a good practice.

(ns app.whatever
  (:require [app.utils :only [format]]))
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top