These are chat archives for canjs/canjs

20th
Jul 2018
Justin Meyer
@justinbmeyer
Jul 20 2018 01:29
@/all if there's some API in CanJS you'd like to see better documented, please let us know here: canjs/canjs#4116
I'm trying to sort the packages by priority.
qantourisc
@qantourisc
Jul 20 2018 10:23
Can DefineMap.extend have listeners on events ?
Stef
@sronsiek
Jul 20 2018 15:21

Hello everyone - I'm seeing in issue combining viewmodel inheritance & Promises - perhaps it's obvious (). canjs 4:
``` refreshFleets: function() {
var self = this;

return new Promise( function (resolve, reject) {
  Fleet.getList({'__sort':'name'}).then(function(items) {
    self.fleets = items;
    resolve( self, items );
  });
});

},

the above is called by:
```  addNew: function() {
    var xxxself = this;
    var parentFunc = this._super;

    this.refreshFleets().then( function(xxx, items) {
      // At this point self is the Window object for some reason
      // and all attempts to call _super() fail
      // xxx._super();     // xxx._super is not a function crash
      // parentFunc();     // Goes into the parent function, but within it, 'this' is undefined
      xxxself._super();  // xxx._super is not a function crash
    });
  },
Need to work on my mardown obviously ;)
Why would calls to _super() not work within the Promise reolve?
Matthew Phillips
@matthewp
Jul 20 2018 15:35
Not sure... i would expect that to work
var parentFunc = this._super.bind(this)
what about that ^^
@sronsiek
Stef
@sronsiek
Jul 20 2018 15:36
Let me try ..
Justin Meyer
@justinbmeyer
Jul 20 2018 15:39
Stef
@sronsiek
Jul 20 2018 15:41
@matthewp - only works! Excellent thanks! Though not sure why ...
Bridget Carberry
@bcarberry
Jul 20 2018 17:59
Hi there, I'm just getting started with CanJS. I'm getting a console error when trying to run the CanJS+Webpack example on the 'can-5' branch. However master branch runs fine.
"Error: Event "can-attribute-observable-radiochange" is already registered"
Kevin Phillips
@phillipskevin
Jul 20 2018 18:05
Thanks @bcarberry for letting us know. Will take a look at it.
Bridget Carberry
@bcarberry
Jul 20 2018 18:07
Thanks @phillipskevin !
Kevin Phillips
@phillipskevin
Jul 20 2018 18:14
did you get that error just by starting the app?
I was able to start it ok with a fresh npm install
Bridget Carberry
@bcarberry
Jul 20 2018 18:15
Yeah, I pulled down the repo, ran npm install, however when I visit the local server I get that error in the web console
Kevin Phillips
@phillipskevin
Jul 20 2018 18:17
hmm, maybe an issue with a package-lock or something?
you can try deleting any package-lock.json and deleting the node_modules folder and re-installing
or you can try running npm ls can-attribute-observable to try to figure out the issue
Bridget Carberry
@bcarberry
Jul 20 2018 18:20
that worked! thank you
Kevin Phillips
@phillipskevin
Jul 20 2018 18:20
great
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jul 20 2018 18:22
@phillipskevin thank you