r/Clojure • • Apr 07 '21

ClojureScript - 1.10.844 Release

https://clojurescript.org/news/2021-04-06-release
70 Upvotes

2 comments sorted by

13

u/yogthos Apr 07 '21

being able to easily consume default exports from NPM modules is very welcome

2

u/TheLastSock Apr 07 '21

Would this be an example of exporting a javascript object as a library?

MyModule.js

var MyObject = function() {

    // This is private because it is not being return
    var _privateFunction = function(param1, param2) {
        ...
        return;
    }

    var function1 = function(param1, callback) {
        ...
        callback(err, results);    
    }

    var function2 = function(param1, param2, callback) {
        ...
        callback(err, results);    
    }

    return {
        function1: function1
       ,function2: function2
    }
}();

module.exports = MyObject;

In which case we would have the following cljs?

(ns foo
  (:require [myModule$MyObject :as sub-lib :refer [...]]))