funcool

A channel for discussing and asking questions about Funcool libraries https://github.com/funcool/
kenny 2016-05-27T07:48:22.000075Z

@niwinz: Getting

Uncaught TypeError: Cannot set property '_bitField' of undefined
with advanced compilation. Using promesa 1.2.0. Example code:
(ns cljs-js-wrapper.core
  (:require [promesa.core :as p]
            [beicon.core :as s]
            [postal.client :as pc]))

(enable-console-print!)

(defn ^:export client
  [url]
  (pc/client url))

(defn ^:export subscribe
  [c dest data]
  (pc/subscribe c dest (js->clj data :keywordize-keys true)))

(defn ^:export on-value
  [bus val-fn err-fn done-fn]
  (s/subscribe bus
               (fn [v]
                 (val-fn (clj->js v)))
               (fn [v]
                 (err-fn (clj->js v)))
               done-fn))

(defn ^:export send
  [c opts callback]
  (p/then (pc/send! c (js->clj opts :keywordize-keys true))
          (fn [frame]
            (callback (clj->js frame)))))

kenny 2016-05-27T07:48:57.000076Z

Works in any other compilation besides :advanced

niwinz 2016-05-27T07:49:08.000077Z

hmm, strange

niwinz 2016-05-27T07:49:11.000078Z

thanks

kenny 2016-05-27T07:49:57.000079Z

FYI, calling the code from JS like this:

var a = cljs_js_wrapper.core;
var client = a.client("<http://localhost:3447/api>");
a.subscribe(client, "stream-update");
a.send(client, {type: "novelty", dest: "foo", data: {id: "123"}}, function(v){
	console.log(v);
})

niwinz 2016-05-27T08:14:09.000080Z

looks nice

niwinz 2016-05-27T08:14:17.000081Z

abou the _bitField...

niwinz 2016-05-27T08:14:31.000082Z

is strange because this is completly internal to bluebird

niwinz 2016-05-27T08:15:14.000083Z

this is something thag google closure compiler in theory does not touches...

kenny 2016-05-27T18:30:33.000084Z

@niwinz: Right. I was thinking it may have something to do with the externs. Might be worth trying to update bluebird to the latest?

2016-05-27T20:30:25.000085Z

@niwinz or @kenny : are you the owner of https://github.com/funcool/postal ? I have a pr for you if your are interested https://github.com/funcool/postal/pull/3

kenny 2016-05-27T20:31:53.000087Z

I am not. @niwinz is.