Giter Site home page Giter Site logo

Comments (8)

borkdude avatar borkdude commented on May 25, 2024 1

I would say that's overkill

from nbb.

borkdude avatar borkdude commented on May 25, 2024

:init would be a function, like in clojure.main/repl

from nbb.

jaidetree avatar jaidetree commented on May 25, 2024

Oh my mistake, that means it would be like this?

(require ‘[promesa.core :as p])

(repl/repl
  {:init #(apply require ‘[[promesa.core] :as p]
                           [clojure.repl :refer [doc]]
                           [cljs.pprint :refer [pp pprint]])})

Then the implementation should run that within a promise?

from nbb.

borkdude avatar borkdude commented on May 25, 2024

the function can return a promise or an ordinary function and will then be chained onto the rest of the stuff here:

(.then (fn []

from nbb.

jaidetree avatar jaidetree commented on May 25, 2024

That helps a lot! Last question: How should it deal with the optionality?

(-> ...
    (.then (if (ifn? (:init opts)) (:init opts) identity)))

from nbb.

borkdude avatar borkdude commented on May 25, 2024

I'd say:

(let [init (:init opts identity)]
  (.then (...) init)

from nbb.

jaidetree avatar jaidetree commented on May 25, 2024

Should that let also contain a runtime check like?

(when-not (ifn? init)
  (js/throw (js/Error. ":init must be a function")))

from nbb.

borkdude avatar borkdude commented on May 25, 2024

@eccentric-j Maybe this would also be nice to have for the nREPL server? But I'll close the existing issue for now.

from nbb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.