These are chat archives for canjs/canjs

5th
Sep 2018
Gregg Roemhildt
@roemhildtg
Sep 05 2018 02:49
hi guys, I hadn't seen much for file stuff with canjs yet so I added a nifty little drag-n-drop functionality for file's in canjs - https://github.com/roemhildtg/spectre-canjs/releases/tag/v3.4.0
Gregg Roemhildt
@roemhildtg
Sep 05 2018 03:02
Julian
@pYr0x
Sep 05 2018 07:32
:thumbsup:
Viktor Busko
@Lighttree
Sep 05 2018 11:34

Guys is there way to make this work ? (in canjs@3, but its way easier to create such examples with canjs@5 :))

https://codepen.io/Lighttree/pen/XPamWa?editors=1010

Soo... the goal is change 'initial value' to 'new value' after some time.

Gregg Roemhildt
@roemhildtg
Sep 05 2018 12:05
I think in canjs 3 you'd want to use a compute. https://canjs.com/doc/can-compute.html
Viktor Busko
@Lighttree
Sep 05 2018 12:35
yes, but it doesn't work as well, so Ive created analog in 5th just for presentation and playground
Kevin Phillips
@phillipskevin
Sep 05 2018 14:23
@Lighttree do you need to use an observable?
you can just use a TextNode
did I show you this already? or maybe @roemhildtg was doing something similar a while back?
Viktor Busko
@Lighttree
Sep 05 2018 14:26
yeah, I actually use it. I've create quite good translation service with your help :)
But as people started use it, we found more issues with textNodes. For example we can't use textNode as attribute values, so
if you need translated alt for img tags, you will have [Object Text] :(
Another issue found in case when you clone HTML nodes, but I think its not directly because of textNode, but because of async behavior that I need.
So currently I'm looking for a way to provide people helper that returns string if they need, even if it creates more "listeners".
Kevin Phillips
@phillipskevin
Sep 05 2018 15:51
what wasn't working when using can-compute?
Kevin Phillips
@phillipskevin
Sep 05 2018 16:06
seems to work correctly if you ObservationRecorder.ignore the helper function: https://codepen.io/kphillips86/pen/rZzmbj?editors=0010
(Observation.ignore in 3.x)
Justin Meyer
@justinbmeyer
Sep 05 2018 16:20
@pYr0x new DefineMap( map.get() )
@RyanMilligan once you start doing that, you should probably just create components and pass them new MyComponent({viewModel: {someAttribute: ..., somethingelse: ... })
@roemhildtg awesome!!!
RyanMilligan
@RyanMilligan
Sep 05 2018 16:23
Well, first of all, we're working in Can3, which I don't believe supports that. Second, I should have been more clear but we're looking to choose HTML tags here; label, h3 and the like. We're trying to get our Can3 application to work with some rather brittle legacy CSS styles, so adding new tags around things isn't always an option.