Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 01:04
    greenkeeper[bot] commented #5392
  • 01:04

    greenkeeper[bot] on core-js-3.5.0

    chore(package): update core-js … (compare)

  • Dec 11 18:34
    greenkeeper[bot] labeled #5444
  • Dec 11 18:34
    greenkeeper[bot] opened #5444
  • Dec 11 18:34

    greenkeeper[bot] on can-observable-mixin-1.0.7

    fix(package): update can-observ… (compare)

  • Dec 11 18:30

    cherifGsoul on update-infrastructure-page

    (compare)

  • Dec 11 18:30

    cherifGsoul on master

    Update infrastructure page with… (compare)

  • Dec 11 18:30
    cherifGsoul closed #5441
  • Dec 11 18:30
    cherifGsoul closed #5417
  • Dec 10 17:40
    cherifGsoul review_requested #5443
  • Dec 10 16:47
    cherifGsoul review_requested #5441
  • Dec 10 16:35
    cherifGsoul synchronize #5441
  • Dec 10 16:35

    cherifGsoul on update-infrastructure-page

    Fix typos (compare)

  • Dec 10 10:01
    jkeruzec starred canjs/canjs
  • Dec 09 18:59
    cherifGsoul review_requested #5443
  • Dec 09 18:59
    cherifGsoul opened #5443
  • Dec 09 18:51

    cherifGsoul on document-inserted-removed-can6

    Add inserted/removed events to … (compare)

  • Dec 09 15:38
    greenkeeper[bot] labeled #5442
  • Dec 09 15:38
    greenkeeper[bot] opened #5442
  • Dec 09 15:38

    greenkeeper[bot] on can-view-live-5.0.1

    fix(package): update can-view-l… (compare)

Kevin Phillips
@phillipskevin
can-define/map/map is a slightly different thing
Frank Lemanschik
@frank-dspeed
ah now we are on the same point :)
Gregg Roemhildt
@roemhildtg
Oh, I see.
Kevin Phillips
@phillipskevin
can-map/can-map-define has attr() and works the same as the Map and define plugin in 2.3
Frank Lemanschik
@frank-dspeed
DifineMap nativ should get depricated or not?
Kevin Phillips
@phillipskevin
DefineMap you don’t need to use attr()
Gregg Roemhildt
@roemhildtg
I like using DefineMap since there's no need for attr
Kevin Phillips
@phillipskevin
DefineMap is the new way
Gregg Roemhildt
@roemhildtg
But can you confirm whether or not the set behavior has changed?
Kevin Phillips
@phillipskevin
set works the same
it’s the value that is not working in your example I think
Frank Lemanschik
@frank-dspeed
the old works but should complain when using attr
Kevin Phillips
@phillipskevin
no can-map-define is a different module
you have to use attr
@roemhildtg
let a = can.DefineMap.extend('a', {
  init(){
    console.log(arguments);
  },
  val: {
    set(val){
      console.log('hey there', val);
      return val;
    }
  }
})
let b = new a();
b.val = 'Hello';
console.log(b.val)
that does what you’re expecting
Frank Lemanschik
@frank-dspeed
ya but you agre with me that we don't use that this way any more as we do var DefineMap = require("can-define/map/map");
Kevin Phillips
@phillipskevin
don’t use what this way?
can-map and can-map-define are legacy modules
for backward compatibility
Frank Lemanschik
@frank-dspeed
we don't use can-map-define in donejs examples
ya
thats what i mean they are still updated but not used any more
Kevin Phillips
@phillipskevin
the donejs examples will be updated to use DefineMap, yeah
Frank Lemanschik
@frank-dspeed
they get replaced by the lazy models
Kevin Phillips
@phillipskevin
and generators, etc
Frank Lemanschik
@frank-dspeed
ya thats what i mean :)
Gregg Roemhildt
@roemhildtg
Okay, but I can provide a default value still, its just this doesn't call the set method anymore?
Frank Lemanschik
@frank-dspeed
i depricated it and throw it out all over
Oh @phillipskevin do you maybe know or tryed it what happens to a 2.3 project when you switch do can3.0
and use the legacy stuff does it work?
Kevin Phillips
@phillipskevin
yes
Frank Lemanschik
@frank-dspeed
so we are compatible wow
Kevin Phillips
@phillipskevin
yeah, we have client projects that are upgrading to 3.0
Frank Lemanschik
@frank-dspeed
don't knowed that fact should consider that in the genrator
ya upgrading means for me also changing the components
i mean it works to only change the requires and imports and they still work nothing left out?
Kevin Phillips
@phillipskevin
no, you do have to make some changes
@roemhildtg to answer your question… I’m not sure
Gregg Roemhildt
@roemhildtg
I've been doing the future proof migration, its not so bad. It cleans up the code a lot removing all of the .attr stuff
Kevin Phillips
@phillipskevin
I don’t think setting a default value on DefineMap like that does what you want
Gregg Roemhildt
@roemhildtg
Okay just thought I'd ask. I do know that in the previous version set would be called when the default value was set. http://jsbin.com/wicuguwisa/edit?html,js,console,output
Kevin Phillips
@phillipskevin
yeah
there are some differences with the order of how the define properties get set up
if that’s something you need, feel free to open an issue
Frank Lemanschik
@frank-dspeed
@phillipskevin do you have a idea what happens to such?
Kevin Phillips
@phillipskevin
not sure what you mean
Frank Lemanschik
@frank-dspeed

canMap.extend(
/ @prototype */
{
define: {
/

     * @property {office/models/session} office/components/navigation.loginSession loginSession
     * @parent office/components/navigation.properties
     *
     * A placeholder session with a nested [office/models/user user] property that
     * is used for two-way binding the login form's username and password.
     */
    loginSession: {
        value: function(){
            return new Session({user: new User()});
        }
    }
    /**
     * @property {office/app} office/components/navigation.app app
     * @parent office/components/navigation.properties
     *
     * The [office/app] used to add or destroy the session.
     */
     /**
      * @property {Promise<office/models/session>} office/components/navigation.sessionPromise sessionPromise
      * @parent office/components/navigation.properties
      *
      * The promise that resolves when the user is logged in.
      */
},
/**
 * @function createSession
 *
 * Creates the session on the server and when successful updates [office/components/navigation.app]
 * with the session. Sets [office/components/navigation.sessionPromise].
 * @param {Event} [ev] Optional DOM event that will be prevented if passed.
 */
createSession: function(ev){
    if(ev) {
        ev.preventDefault();
    }
    var self = this;
    var sessionPromise = this.attr("loginSession").save().then(function(session){

        self.attr("loginSession", new Session({user: new User()}));
        self.attr("app").attr("session", session);

    });
    this.attr("sessionPromise", sessionPromise);
},

```

you see we have a map and then define:{}