These are chat archives for canjs/canjs

2nd
May 2017
Ivo Pinheiro
@ivospinheiro
May 02 2017 14:34
Hi guys!
Is there any replacement to CanJS plugin "can/list/promise" that was available on CanJS 2 on CanJS 3?
Morgan Heimbeck
@Xitstrategies
May 02 2017 15:23
it is built in to can-define/list and can-list
Matthew Phillips
@matthewp
May 02 2017 16:18
@web-mech thanks for making can-define-stream-rxjs!
Michael Price
@web-mech
May 02 2017 17:00
@matthewp It was my pleasure!
Craig Naumann
@cwn72
May 02 2017 18:33
Hey guys, i'm following the chat guide, but when I get to the part with polling for messages, I get an error: Mixed Content: The page at 'https://jsbin.com/sodeeeya/edit?html,js,output' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://chat.donejs.com/api/messages'. This request has been blocked; the content must be served over HTTPS.
when I try changing the url to https, it give me another error: GET https://chat.donejs.com/api/messages net::ERR_INSECURE_RESPONSE
any ideas here?
Eben
@eben-roux
May 02 2017 18:36
@cwn72 : which browser are you using (for interests sake)?
Craig Naumann
@cwn72
May 02 2017 18:36
@eben-roux: Chrome 57.0.2987.133 (64-bit)
Eben
@eben-roux
May 02 2017 18:36
the low-down is that browsers typically do not allow non-secure ajax calls when the domain you are requesting from is secure.
So if your site is hosted on HTTPS you'll have a hard time getting anything from HTTP
Chrome introduced this about 1.5 years ago
Firefox soon followed
With Chrome a little shield used to appear in the address bar giving you the option to allow unsafe requests
the jsbin isn't loading for me...
Craig Naumann
@cwn72
May 02 2017 18:39
yeah its the wrong url, i changed it cause i'm paranoid
just weird because the host is //chat.donejs.com/api/messages, and trying to use https gives ERR_INSECURE_RESPONSE
Eben
@eben-roux
May 02 2017 18:41
usually it isn't necessarily as easy as changing the scheme to https... the server has to be configured to host https... certificates and such
Craig Naumann
@cwn72
May 02 2017 18:43
I understand, I'm just trying to find out if the canjs tutorial is outdated, or if (more likely), i'm just doing something stupid
Eben
@eben-roux
May 02 2017 18:43
having a look at your jsbin now
Craig Naumann
@cwn72
May 02 2017 18:44
thanks @eben-roux
Eben
@eben-roux
May 02 2017 18:45
ok, so what I did was to navigate in another tab to https://chat.donejs.com/api/messages
it complained about the security and I click the advanced link and accepted the go ahead business
then the jsbin runs "fine"
Craig Naumann
@cwn72
May 02 2017 18:47
yep that worked for me too @eben-roux, the other option is to load the jsbin without https
Eben
@eben-roux
May 02 2017 18:48
http to https should always work
https to http is the issue
Craig Naumann
@cwn72
May 02 2017 18:49
right
idk who the right person to talk to about this would be, but they should definitely update their tutorial, it doesn't work out of the box
thanks again @eben-roux
Eben
@eben-roux
May 02 2017 18:51
image.png
The tutorial is probably fine. I think it is just a certificate issue.
Chrome can get its knickers in a knot about things sometimes
Craig Naumann
@cwn72
May 02 2017 18:52
I think it is both, the url they give you in the tutorial is explicitly http instead of https, and if you debug that on your own that is when you find they have cert issues
Eben
@eben-roux
May 02 2017 18:54
I haven't looked at the tutorial but perhaps they assume you are using http hosting as that is what one typically would do when developing locally.
Since you are using jsbin it is https as everything on the web is gravitating towards security
but agreed, these things can be mentioned/explained in the tutorial also and I'm sure the folks will be doing so as time goes by. You can always add a little something to the docs via GitHub and send them a PR :)
Gregg Roemhildt
@roemhildtg
May 02 2017 18:57
In stache templates, how can I check if a property exists, when the property is a function? {{#if value.myFunc}} seems to be calling myFunc, which makes sense. Would it be like this? {{#if @value.myFunc}}
Eben
@eben-roux
May 02 2017 19:08
@roemhildtg : could you not define it with a getter?
ah, hang on... unless you want to check wither the function itself is defined? In such as case perhaps using another attribute as a flag could work...
Eben
@eben-roux
May 02 2017 19:15
since v3.0 is out... what is the best way to "refresh" a can-connect promise?
so if I have a "refresh" button that should force a fetch of the data from the server again.
Nils Lundquist
@nlundquist
May 02 2017 19:15
@roemhildtg {{#if @value.myFunc}} should work but there was a bug preventing from working: canjs/can-stache#172
are you using can-stache 3.0.24? that should resolve your issue
Morgan Heimbeck
@Xitstrategies
May 02 2017 19:20
@eben-roux are you using the model tags or are you putting the connection in the viewModel?
Eben
@eben-roux
May 02 2017 19:21
using the view model
image.png
Morgan Heimbeck
@Xitstrategies
May 02 2017 19:22
that is how I am doing it too. I just put a prop on the viewModel and put it in the getter and change it with the button or whatever action I am wanting to trigger the refresh with. So when the value changes, it triggers a change in the getter.
Eben
@eben-roux
May 02 2017 19:23
That was the last guidance I saw too... seems ok. Thanks.
Morgan Heimbeck
@Xitstrategies
May 02 2017 19:23
get usersPromise() {
this.refreshCount;
return User.getList({});
}
no problem
Gregg Roemhildt
@roemhildtg
May 02 2017 19:24
@eben-roux , yep I'd like to check if the function is defined before calling it
@Xitstrategies I'm currently on 3.0.22 but I'll update and see if that works
Gregg Roemhildt
@roemhildtg
May 02 2017 19:44
Okay, I couldn't get it to work at first, but this is what I have working: {{#if value@myFunc}}
Fixed typo
Eben
@eben-roux
May 02 2017 19:46
was that a typo? I actually have this to pass a reference in one stache file: modal.confirmation.@primaryClick
seems to work... unless it is going to stop working in an update :)
Gregg Roemhildt
@roemhildtg
May 02 2017 19:47
Yeah, I'm using it without the .
And it appears to be working :confused:
Eben
@eben-roux
May 02 2017 19:47
odd... will have to keep an eye on that
Brad Momberger
@bmomberger-bitovi
May 02 2017 19:47
Hi all, just reading the backscroll after coming back from lunch. You should be able to avoid the certificate warning in JSBin+chat+https by using https://donejs-chat.herokuapp.com/api/messages as your API endpoint.
Eben
@eben-roux
May 02 2017 19:48
Hi Brad, perhaps the tutorial could warn about the warning... he he
Flavio Garcia
@piraz
May 02 2017 19:59
Hello guys. I'm still trying getting comfortable with canjs3. I would know how to disable the some crud methods from the can-connect. Is there a easy way to do that?
Gregg Roemhildt
@roemhildtg
May 02 2017 20:04
@piraz I think you would just exclude the data-url from your list of behaviors. And then you'd implement the ones you want in a new custom behavior
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:04
@eben-roux donejs/donejs#935
Eben
@eben-roux
May 02 2017 20:05
:)
Flavio Garcia
@piraz
May 02 2017 20:05
I think I was looking for this https://canjs.com/doc/can-connect/data/url/url.html @roemhildtg .
Gregg Roemhildt
@roemhildtg
May 02 2017 20:06
Yep, that is the one
Flavio Garcia
@piraz
May 02 2017 20:06
Another question, anyone knows where can.deparam was placed?
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:06
It's its own repo now: can-deparam
Flavio Garcia
@piraz
May 02 2017 20:08
Thanks @bmomberger-bitovi . Is it new?
not on the list of projects on docs
It comes as dependency, great
Eben
@eben-roux
May 02 2017 20:10
@piraz seems to be part of can-util: https://canjs.com/doc/can-util/js/deparam/deparam.html
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:10
Yes, it's new as of a few weeks ago; it was broken off from can-util on 30 March and isn't yet part of a CanJS rollup. It will be in CanJS 3.6
Eben
@eben-roux
May 02 2017 20:10
lol
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:10
You can still use deparam from can-util but it's deprecated.
Flavio Garcia
@piraz
May 02 2017 20:13
By the way, as a feedback, I'm having fun with can and steal using yarn
Used to map with bower on can 2
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:13
...which is less fun.
Flavio Garcia
@piraz
May 02 2017 20:14
bower or yarn?
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:14
Bower.
I had a project which was using both npm and bower. With steal 1 and can 3 I was able to get rid of all the bower dependencies.
and then things were much smoother.
Flavio Garcia
@piraz
May 02 2017 20:16
yep, steal config is only defining plugins, bootstrap and jquery
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:16
Apropos of nothing, I overhauled the DoneJS example app on Glitch today. https://glitch.com/edit/#!/donejs-helloworld
Flavio Garcia
@piraz
May 02 2017 20:16
before was kind of a big exercise
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:17
You can remix it and get started on new DoneJS apps without having to config anything locally.
Flavio Garcia
@piraz
May 02 2017 20:21
What DoneJS can offer to me if I'm not using the server side part?
Brad Momberger
@bmomberger-bitovi
May 02 2017 20:29
If you're not using done-serve, you still might get some mileage from done-autorender (lets you render your entire HTML with Staches) and the CLI tools: done-component (scaffold generator), done-cordova (mobile app builds of your web app), and donejs-documentjs for creating document page trees from your inline docs and markdown.