This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-26
Channels
- # aleph (2)
- # beginners (119)
- # boot (18)
- # cider (19)
- # cljs-dev (46)
- # cljsjs (1)
- # cljsrn (30)
- # clojure (101)
- # clojure-dusseldorf (12)
- # clojure-finland (1)
- # clojure-greece (7)
- # clojure-india (2)
- # clojure-italy (6)
- # clojure-poland (4)
- # clojure-russia (120)
- # clojure-sg (3)
- # clojure-spec (147)
- # clojure-uk (75)
- # clojurescript (86)
- # cursive (4)
- # datomic (50)
- # docker (1)
- # emacs (4)
- # juxt (51)
- # leiningen (16)
- # liberator (1)
- # luminus (1)
- # lumo (116)
- # mount (2)
- # off-topic (2)
- # onyx (38)
- # pedestal (4)
- # protorepl (2)
- # re-frame (44)
- # reagent (8)
- # ring-swagger (16)
- # schema (5)
- # specter (16)
- # test-check (226)
does anyone know how to require functions from this ns? https://github.com/clojure/clojurescript/blob/master/src/main/cljs/clojure/data.cljs
i've tried things like (use 'cljs.clojure.data)
, (require 'cljs.data)
, etc
clojure.data
go by the name given in the ns form
(use 'clojure.data)
throws an error. something i'm missing here?
in cljs repl
oh hey i got it working by adding clojure.data
to the namespace form, outside of the repl
thanks
@anmonteiro Wouldn't it make sense to squeeze the "module which is not package" cases close to :npm-deps
and index all the things in one go?
Does anyone have any links to documentation about monitoring atoms and memory usage? I’ve got a situation where I think I’m doing something a bit odd and it’s causing big garbage collection pauses
Also, the project is using Matter.JS as a physics engine, and I’ve got lots of references to JS objects that it creates and updates. Would there be any particular issues with storing these in a map in a global state atom?
well I’ve been profiling with that, but the output is a bit incomprehensible for me! That’s why I was wondering if there was any tutorials for using tools like that to profile ClojureScript
I think I’m probably using it wrong, and/or need a better understanding of it. It chucks out a load of stuff but I can’t see how it relates to the objects and data structures in my clojurescript code
you could hand-roll something to track number of your atoms and how much is stored there, I would double check that you don’t keep references to “historical” objects, so that each frame you release all garbage properly
@gmercer (def format js/goog.string.format)
, but that assumes that you required the goog.string.format package correctly
this case is a bit tricky: https://github.com/google/closure-library/blob/master/closure/goog/string/stringformat.js#L39
or just [goog.string.format]
and then js/goog.string.format
, because goog.string.format
pulls in goog.string
implicitly: https://github.com/google/closure-library/blob/master/closure/goog/string/stringformat.js#L27
not having any luck with the :refer suggestion .. I was hoping to leave the current clj alone - the def seems to be doing the trick
I’m 100% sure [goog.string.format] [goog.string :as gstr]
and then gstr/format
worked for me at some point in the past
I can live with the def .. which is better than reader hacking all of the working clj code
I think your best bet is to require [goog.string.format]
and then (def format js/goog.string.format)
> I’m 100% sure [goog.string.format] [goog.string :as gstr]
and then gstr/format
worked for me at some point in the past
How do you test for exception on cljs.test?
(is (thrown? js/TypeError ....)
for example
Does cljs allow defining one protocol implementation for multiple types with this syntax: (extend-protocol IFoo BarType BazType (foo [_]...))
?
trying to do the cljs equivalent of viewer.open({tileSource: "/dzi/testdz.dzi"});
what I currently have
(. js/viewer (open "{tileSource:
\"/dzi/testdz.dzi\"}"))
thanks, I meant passing cljs functions to js as callbacks (onsuccess, onfailure, etc.)
Trying to translate a bit of JS into CLJS...
var imageData = context2d.createImageData(width, height);
imageData.data.set(new Uint8ClampedArray(bufferToReturn));
context2d.putImageData(imageData, x_offset, y_offset);
Is that set
a method call? Would I do (.set (.-data imageData) (js/Uint8ClampedArray. buffer-to-return)))
??@oahner I've tried passing it a (js/Float32Array. [0 1 2 3 4 5])
and (.-buffer ...
version of that. I can see there is data in the array I'm passing to the UInt8ClampedArray
constructor. I must not be using the constructor right.
mdn says it takes an object. To pass a buffer, it says, new Uint8ClampedArray(buffer [, byteOffset [, length]]);
... Does that mean I should do (js/Uint8ClampedArray buffer #js [0 #js [4]])
?
imageData.data.set is TypedArray.set, it can take a TypedArray instance or a regular array
@oahner Oh, also, I'm trying to send arrays to and from web workers and so I need to send the Transferable ArrayBuffer. Is there a way to pass the ArrayBuffer in instead? Or convert the ArrayBuffer back into an Array?
Basically, trying to do as much of the image prep on the worker side as possible, and just feed the finished buffer into the canvas context on the main thread side.
@john you can get the underlying buffer with TypedArray.prototype.buffer and send that
I need to call js constructor as a function, how do I do that? e.g. (apply js/Date. x)
won’t work