Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 16:24
    kaleidawave starred canjs/canjs
  • Apr 02 19:18
    JimMorrison723 starred canjs/canjs
  • Apr 01 03:34
    GraceFatima commented on 695c6da
  • Mar 31 06:37
    hrnkoji starred canjs/canjs
  • Mar 26 22:02
    greenkeeper[bot] commented #5469
  • Mar 26 22:02

    greenkeeper[bot] on @octokit

    chore(package): update @octokit… (compare)

  • Mar 25 21:18
    sdillen starred canjs/canjs
  • Mar 25 20:34
    Aliens-dev starred canjs/canjs
  • Mar 25 19:43
    greenkeeper[bot] commented #5469
  • Mar 25 19:43

    greenkeeper[bot] on @octokit

    chore(package): update @octokit… (compare)

  • Mar 25 08:06
    leepeterson starred canjs/canjs
  • Mar 24 21:23
    greenkeeper[bot] commented #5469
  • Mar 24 21:23

    greenkeeper[bot] on @octokit

    chore(package): update @octokit… (compare)

  • Mar 24 07:00

    greenkeeper[bot] on webpack-4.42.1

    (compare)

  • Mar 24 06:58

    greenkeeper[bot] on webpack-4.42.1

    chore(package): update webpack … (compare)

  • Mar 21 01:00
    greenkeeper[bot] commented #5469
  • Mar 21 01:00

    greenkeeper[bot] on @octokit

    chore(package): update @octokit… (compare)

  • Mar 20 06:52
    christianfelicite starred canjs/canjs
  • Mar 18 10:30
    dinko starred canjs/canjs
  • Mar 17 19:33

    cherifGsoul on master

    Update dist for release (compare)

Gerard Finnerty
@halcyonandon
do I need to do something with options.fn or options.inverse? The documents don't state if this is required
Chris Gomez
@akagomez
@halcyonandon Yes. You need to return 1) options.fn(), 2)options.inverse(), or 3) a String.
Gerard Finnerty
@halcyonandon
ohhhhhh, ok... trying that, thanks @akagomez
Chris Gomez
@akagomez
Not a problem.
Gerard Finnerty
@halcyonandon
yeah that worked, thanks again
opolyo01
@opolyo01
Wow, looks like I found a bug in can.Component. The scope changes are not getting fired for certain Objects
self.attr( 'queryResult', response );
//Redraw chart if type changes or new data is available
'{scope} queryResult': function( Scope, ev, newVal ) {
debugger;
if(!newVal.isEmpty) {
this.drawChart();
}
},
queryResult function is only getting called when I pass certain type of data to it
It goes back to mine circular dependency issue that I mentioned yesterday.. the object with complex nesting is not getting called, while simple responses do
Chris Gomez
@akagomez
@opolyo01 Can you copy your component into a gist for one of us to look at?
opolyo01
@opolyo01
James is helping me now
Chris Gomez
@akagomez
Oh wow! I didn’t know you could PM in Gitter.
James Atherton
@James0x57
Am on screenhero, he just joined the team on client's side so he has me on there =)
Chris Gomez
@akagomez
Cool.
Alexis Abril
@alexisabril
I have a helper with an element cb. Should the cb be invoked on compute updates? http://jsbin.com/cufuvi/latest/edit
Chris Gomez
@akagomez
@alexisabril Isn’t the callback meant to be run once the element is inserted into the DOM?
Alexis Abril
@alexisabril
yeah, I think that’s the intent. I was just attempting to avoid binding manually
Gerard Finnerty
@halcyonandon
if I do something like this in a component, '{scope} editMode': function() { }' ...where editMode is truthy, on editMode change, this event fires and the viewModel has been updated, but the dom is still the previous state, making it out-of-sync with the attribute value
so how do i bind/unbind to a dom selector that is shown/hidden via truthy mustache conditions?
i could wrap it in a timeout and it should work, but that's super hacky
Alexis Abril
@alexisabril
@halcyonandon If you share a jsbin, we could take a look. It’s hard to say what the issue could be without seeing the viewmodel, template and events you’ve setup.
Chris Gomez
@akagomez
@halcyonandon You’ve bound to the event. Not the insertion of the DOM, so this makes sense.
What type of DOM manipulation are you intending to do once that DOM is inserted? I ask because most of the time this is a better job for the template.
Gerard Finnerty
@halcyonandon
@akagomez I've got bootstrap popovers that need to be instantiated when the elements re-render on change of edit mode, since the elements are added and removed from the dom. I'm not sure how i would do so from the template
Chris Gomez
@akagomez
Ah. I see.
There are some options.
You could also not remove your DOM and instead just hide it.
Gerard Finnerty
@halcyonandon
its a complex ui, the edit mode needs to be removed as a requirement , but thank you, this gave me some alternatives to the setTimeout to play with
opolyo01
@opolyo01
Found an issue, but trying to figure out the best way to resolve deferred without making separate AJAX calls
find: function ( type, params ) {
var key;
key = JSON.stringify( params );
if ( ! promiseStore [ key ] ) {
promiseStore[ key ] = $.ajax({
url: can.sub(steal.config('API')[ type ], params, true),
data: params,
type: 'GET',
dataType: 'json',
// work around the ajax bug in chrome
cache: false
});
        }
        return promiseStore[ key ];
    },
I call this find method in bunch of components, and goal is to make a single Ajax request, and get the rest from Cache. However, the first then is getting resolved, but other then calls already being resolved
Is there a good pattern to solve this issue? I am thinking to add else wrap it in the separate Deferred
Patrick Clancy
@patrickclancy
I’m starting to add validation to a can v2.3-pre project. Is the validation plugin still the perferred way to define model validation?
Matthew Phillips
@matthewp
unfortunately yes
dylanrtt
@dylanrtt
what does the future of validations look like?
Patrick Clancy
@patrickclancy
@dylanrtt I found this. bitovi/canjs#1111
Matthew Phillips
@matthewp
yeah i think it's one of those things that no one has figured out yet
opolyo01
@opolyo01
@akagomez So to make caching work, do I need to override every method with "make" prefix? Another question is how to actually get this 'findAllData' deferred to work in case if I actually not relying on resources, but making an actual $.ajax request
dylanrtt
@dylanrtt
@opolyo01 I don't think the make prefix works with anything other than the standard functions, so if you have a lot of custom methods on your model, you might have to implement something like what you have above
opolyo01
@opolyo01
does this look right?
if ( ! promiseStore [ key ] ) {
promiseStore[ key ] = $.ajax({
url: can.sub(steal.config('API')[ type ], params, true),
data: params,
type: 'GET',
dataType: 'json',
// work around the ajax bug in chrome
cache: false
});
return promiseStore[ key ];
}
else{
var dfd = $.Deferred();
dfd.promise(promiseStore[ key ]);
dfd.resolve( JSON.parse(promiseStore[ key ].responseText) );
return promiseStore[ key ];
}
dylanrtt
@dylanrtt

@opolyo01 you can probably do it exactly like the QuickCache example. just copy the makeFindAll function out so it's independent and call it like this

var TodoModel = can.Model.extend({
  findTodos: makeCacheable(function(){
    return $.ajax(/*params*/);
  })
}, {});

That should allow you to make any request function cacheable. You can still use it with the standard find methods like this:

var QuickCacheModel = can.Model.extend({
  makeFindAll: makeCacheable
}, {});
Curtis Cummings
@ccummings
I’m trying to create a nested Map that can have children that are the same type. Here’s a jsbin of the setup: http://jsbin.com/peyesififu/1/edit
Depending on what’s defined first I can either have the list be the right type or the map, but not both
dylanrtt
@dylanrtt
@ccummings I had this issue before. Basically one of them needs to be defined before you can reference it in the other. I solved this by modifying the define block of one prototype after declaring both http://jsbin.com/yosakoqozo/1/edit?html,js,console
Curtis Cummings
@ccummings
My brain must be fried. I can also modify the static Map parameter of the list after both are defined