Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 20 21:04
    m-mujica commented #5303
  • Sep 20 20:23
    m-mujica opened #5303
  • Sep 20 20:23

    m-mujica on upgrade-deps

    Update can-type and can-stache-… (compare)

  • Sep 20 20:05
    m-mujica edited #5302
  • Sep 20 20:03
    m-mujica synchronize #5302
  • Sep 20 20:03

    m-mujica on upgrade

    Upgrade routing guide to Can 6 Fix incorrect highlight Use svg images (instead of .png) (compare)

  • Sep 20 19:32
    m-mujica opened #5302
  • Sep 20 19:29

    m-mujica on upgrade

    Upgrade routing guide to Can 6 Fix incorrect highlight (compare)

  • Sep 20 17:42

    m-mujica on upgrade

    WIP: Upgrade (compare)

  • Sep 20 17:06
    do-adams starred canjs/canjs
  • Sep 20 13:34

    chasenlehara on 5119-testing-guide

    Update the Testing guide for Ca… (compare)

  • Sep 20 13:21
    cherifGsoul commented #5295
  • Sep 20 13:18
    cherifGsoul synchronize #5295
  • Sep 20 13:18

    cherifGsoul on update-theme-new-buttons

    Theme pre-release 2 (compare)

  • Sep 20 10:29

    greenkeeper[bot] on socket.io-client-2.3.0

    (compare)

  • Sep 20 10:26

    greenkeeper[bot] on socket.io-client-2.3.0

    chore(package): update socket.i… (compare)

  • Sep 20 06:40
    HellMagic starred canjs/canjs
  • Sep 19 20:42
    m-mujica commented #5119
  • Sep 19 18:40
    phillipskevin closed #5300
  • Sep 19 18:40
    phillipskevin commented #5300
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:{}
and functions under the define
Gregg Roemhildt
@roemhildtg
Okay, good to know. I think its useful. I'll put in an issue.
Kevin Phillips
@phillipskevin
@frank-dspeed yeah… that’s how can-map and can-map-define work
you can have a CanMap without the define plugin
Frank Lemanschik
@frank-dspeed
i mean
var DefineMap = require("can-define/map/map");
in this case it should only set the define: {} part
not the functions after it right?
whats the component for the functions in can map after the define