Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 12:11
  • Jan 14 11:36
    et0and starred canjs/canjs
  • Jan 13 07:39
    khafidprayoga starred canjs/canjs
  • Jan 06 19:51
  • Dec 14 2021 12:31
    mduraidi starred canjs/canjs
  • Dec 04 2021 02:00
    jpmanson starred canjs/canjs
  • Nov 14 2021 12:55
    falleng0d starred canjs/canjs
  • Nov 13 2021 08:06
    g1964j starred canjs/canjs
  • Nov 13 2021 01:34
    bradms starred canjs/canjs
  • Nov 11 2021 18:47

    eddypjr on master

    Update dist for release (compare)

  • Nov 11 2021 18:46
    eddypjr added as member
  • Nov 11 2021 18:30

    eddypjr on v6.6.2

    Update dist for release 6.6.2 (compare)

  • Nov 11 2021 17:17

    justinbmeyer on v6.6.2


  • Nov 11 2021 16:56
    eddypjr removed as member
  • Nov 11 2021 16:52
    eddypjr added as member
  • Nov 11 2021 16:34

    eddypjr on v6.6.2

    Update dist for release 6.6.2 (compare)

  • Nov 08 2021 13:14
    italy starred canjs/canjs
  • Nov 03 2021 23:12
    shoumaw starred canjs/canjs
  • Oct 22 2021 14:19
    MCKanpolat starred canjs/canjs
  • Oct 21 2021 12:12
    bohanyang starred canjs/canjs
Nico R.
@chasenlehara thanks, it looks good and it works as I expected. I’ll try to modify my donejs project to see if I can reproduce what you did.
Chasen Le Hara
@lmagarian It shouldn’t; value is only run the first time to get the initial value.
Even if it were in a get, it would only run again if something observable changed, but there’s nothing observable in that function.
Let’s say you did need to make that API call again because the arguments changed. That might look something like:
    orderBy: {
        value: "name"
    playersPromise: {
        get: function(){
            return Player.getList({orderBy: this.orderBy});
Nico R.
@chasenlehara it does work in http://jsbin.com/taguluzeku/1/edit?html,js,console,output but when including it into my donejs project it will create the instance and even with default values, but if you modify any of the properties then it will “reset” the object (the if condition is met):
type: function(newPerson) {
  if (newPerson && newPerson instanceof Person === false) {
    console.log('>>> debug data 1:', newPerson);
    return new Person(newPerson);
  return newPerson;
the problem after doing some debug is that the newPerson is the value of the input field, so it will never have any valid data again (as it is just one plain value)
I thought newPerson would at least be an object but only the currently selected input value is passed as newPerson
could it be can 2.x that is causing this?
Kevin Phillips
{($value)}=“newPerson” is binding the value of the <input> with newPerson, right?
Nico R.
@phillipskevin I made a mistake this is the JSbin: http://jsbin.com/kelilib/1/edit?html,js,output
the approach used by @chasenlehara works
but when I use it within the donejs project it won't
the way I use it looks like the jsbin (the last one) so you can set each of the properties
whenever you modify any of the inputs that are binded to a property of this new object then every input field is set with the return new Person(newPerson) code
and newPerson contains whatever you wrote on one of the inputs
not the complete object
Nico R.
it is doing something equivalent to this: myObjectInstance = myObjectInstance.propertyOne
every time you modify (even before saving) it will do that so as a result you enter data on any field and then all the fields are set to null/empty
Kevin Phillips
maybe it’s an issue with {{#with}}, can you try explicitly doing like {($value)}=“newPerson.name”?
Jeroen Cornelissen

How do you handle a bulk save or destroy?
I have something like this: let todos = TodoModel.getList() and every todo has a checkbox and are stored in a selection DefineList.
Now I want to delete the selected todo items.

selection.forEach(todo => {

This results in multiple requests to the backend, how can I group these request?
Do I make a custom funtion in my model bulkDestroy and then splice them out of my todos list? Or how do you handle this?

@chasenlehara thanks!
Nico R.
@phillipskevin your approach does work (instead of {{#with}} access to each variable using newPerson.xxxxx)
but I fixed other stuff at the same time so I need to make sure if that was actually the solution or not
I’ll let you know asap
Kevin Phillips
ok, thanks
Nico R.
@phillipskevin yes, somehow {{#with}} is not working correctly, I’ll try one last thing..
Kevin Phillips
only in donejs?
Nico R.
no it didn’t work (wrap it with an {{#if}} statement)
only in donejs
Kevin Phillips
what about just
Nico R.
I’ll try
cool that did the trick!!!
Kevin Phillips
can you open an issue for {{#with}} ?
in donejs/donejs
Nico R.
sure! thanks again!
Kevin Phillips
we can check if it’s working in 1.0
Justin Meyer
@jeroencornelissen I would put a destroyList or some method on your list that makes the requests
and then call destroyedInstance on each one (assuming can-connect)
I'm getting this error: Error: TypeError: Cannot redefine property: _instanceDefinitions
at Function.defineProperty (<anonymous>)
at defineConfigurableAndNotEnumerable (can-define.js:32)
at DefineMap.define.setup (can-define.js:712)
at DefineMap.setup (map.js:113)
at Function.newInstance (can-construct.js:289)
at DefineMap.init (can-construct.js:594)
at new DefineMap (eval at <anonymous> (can-construct.js:NaN), <anonymous>:3:32)
at Object.observable (can-define.js:818)
at Object.eval (can-define.js:708)
at each (each.js:39)
From this code: Message.get({ "id": messageId })
What does it mean, and how do I fix it?
Frank Lemanschik
it means you should post a issue fully described in can-define project on github
i guess
and befor that search for existing issues
Jeroen Cornelissen
@justinbmeyer What does calling destroyedInstancedo? I expected that it would remove my item from the list, but it doesn’t.
I’ve set up a jsbin with how I thought it would work. See the removeAllItems function.
Kevin Phillips
@lmagarian what does Message look like?
@jeroencornelissen I think you just want destroy