문제

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?

도움이 되었습니까?

해결책

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]]))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top