Where communities thrive


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

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

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

  • 14:49
    greenkeeper[bot] labeled #5379
  • 14:49
    greenkeeper[bot] opened #5379
  • 14:49

    greenkeeper[bot] on can-dom-mutate-2.0.6

    fix(package): update can-dom-mu… (compare)

  • 14:06

    greenkeeper[bot] on webpack-4.41.2

    (compare)

  • 13:37

    greenkeeper[bot] on webpack-4.41.2

    chore(package): update webpack … (compare)

  • Oct 14 21:13
    greenkeeper[bot] labeled #5378
  • Oct 14 21:12
    greenkeeper[bot] opened #5378
  • Oct 14 21:12

    greenkeeper[bot] on can-simple-map-4.3.3

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

  • Oct 14 20:19
    greenkeeper[bot] labeled #5377
  • Oct 14 20:19
    greenkeeper[bot] opened #5377
  • Oct 14 20:19

    greenkeeper[bot] on @feathersjs

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

  • Oct 14 20:18
    greenkeeper[bot] labeled #5376
  • Oct 14 20:18
    greenkeeper[bot] opened #5376
  • Oct 14 20:18

    greenkeeper[bot] on @feathersjs

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

  • Oct 14 14:43
    greenkeeper[bot] closed #5373
  • Oct 14 14:43

    greenkeeper[bot] on can-deep-observable-1.0.1

    (compare)

  • Oct 14 14:42

    m-mujica on update-deep-observable

    (compare)

  • Oct 14 14:42

    m-mujica on master

    Update can-deep-observable to l… Merge pull request #5374 from c… (compare)

Justin Meyer
@justinbmeyer
it was short lived
afterPrevious
Chris Gomez
@akagomez
I’ll look into it. Thanks.
Justin Meyer
@justinbmeyer
is way better
Patrick Clancy
@patrickclancy
If I’m using the define plugin with a can.Map. Shouldn’t the set() function be execute with myMap.attr(’users’).push('123’)?
define: {
  users: {
    value: [],
    set: function(newValue) {
        … side effect stuff here
        return newValue;
    }
}}
Alexis Abril
@alexisabril
Hey @patrickclancy, not for this example. This is because you’re not actually setting users, you’re setting users[‘someIndex’]
in this case, if it’s an empty array, .push would be akin to myMap.attr(‘users.0’, ‘123’);
however, if you did myMap.attr(‘users’, []), the setter would be called as you’d be setting the ‘users’ property directly
Justin Meyer
@justinbmeyer
yeah, the define plugin doesn't work for can.List unfortunately
Patrick Clancy
@patrickclancy
@alexisabril @justinbmeyer Thanks… I realized myMap.attr(‘users’, []) works. I was hoping that there was more magic there. ;-)
Alexis Abril
@alexisabril
it’d be cool if it works with can.List. For that scenario, it be nice to do:
var Collection = can.List.extend({
  define: {
    '*': {
      set: function(val) {
        console.log('setting');
        return val;
      }
    }
  }
});

var c = new Collection();
c.push('abc’);
Patrick Clancy
@patrickclancy
@alexisabril It would be nice. :sparkles:
Patrick Clancy
@patrickclancy

@daffl Do you know which version of phantomjs works with testee on the mac? I’ve installed 1.8.2 with homebrew and I’m still getting the timeout error. Testee works great in my other installed browsers. (safari, chrome…)

patrickclancy$ phantomjs —version -> 1.8.2

  status: 'failed',
  err: 
   { [Error: Browser timed out within 120 seconds]
     message: 'Browser timed out within 120 seconds',
     stack: 'Error: Browser timed out within 120 seconds\n    at testTimedOut [as _onTimeout] (/Users/patrickclancy/.nvm/v0.10.29/lib/node_modules/testee/lib/runner.js:43:42)\n    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)',
     title: 'http://localhost:3996/test/test.html?__token=hdh3gc on {"browser":"phantom"}' },
  title: 'http://localhost:3996/test/test.html?__token=hdh3gc on {"browser":"phantom"}' }
  1) http://localhost:3996/test/test.html?__token=hdh3gc on {"browser":"phantom"}
  testee:reporter updating run +0ms { status: 'finished',
  id: 'b87f411d-4fcd-47c3-9d30-2fe14dd7af0e',
  title: 'General error' }

  0 passing (2m)
  1 failing

  1) General error http://localhost:3996/test/test.html?__token=hdh3gc on {"browser":"phantom"}:
     Error: Browser timed out within 120 seconds
      at testTimedOut [as _onTimeout] (/Users/patrickclancy/.nvm/v0.10.29/lib/node_modules/testee/lib/runner.js:43:42)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
Patrick Clancy
@patrickclancy
Is there a way to work wih radio buttons, can-value and true/false values? I seem to remember that using the define plugin and type: ‘htmlbool’ worked but I was wrong.
Alexis Abril
@alexisabril
@patrickclancy can-value can be set on a radio button, but I might be misunderstanding: http://jsbin.com/yexiji/2/edit?js,console,output
Patrick Clancy
@patrickclancy
@alexisabril Thanks for the jsbin example. In that example the isValid value on the map doesn’t effect/check the radio input. Clicking the radio input does set the value on the map. I realize that the map is using a boolean and the input value is a string. So I’d assume I’d need to configure this property with the define plugin. In the back corners of my mind I had a thought there was some sugar for working with this use case.
Patrick Clancy
@patrickclancy
@alexisabril Here’s what I was thinking would work. http://jsbin.com/neruda/10/edit
Adam L Barrett
@BigAB
Patrick Clancy
@patrickclancy
@BigAB Good to know... I hadn’t tried that. This time around the API I’m working with uses true/false.
dylanrtt
@dylanrtt
@patrickclancy Personally, I would do this with something at the view layer such as custom attributes so you don't have to litter your map definitions with knowledge of how they might be used in the view http://jsbin.com/zozuhevosa/2/edit?html,js,output
Patrick Clancy
@patrickclancy
@dylanrtt That’s cool! I like your idea of pulling it out of the model. ;-)
Alexis Abril
@alexisabril
@patrickclancy Ah, slightly updated version: http://jsbin.com/yexiji/3/edit
Adam L Barrett
@BigAB
@alexisabril that example logs true for both valid and invalid selections
Patrick Clancy
@patrickclancy
@alexisabril nice!! What do you think about @dylanrtt idea of making a custom attribute or componet?
Alexis Abril
@alexisabril
taking a quick peak just now
I like the abstraction
it’s basically a custom can-value
any reason checkboxes aren’t used for the boolean type instead of a radio button?
I know angular actually has filters for this type of stuff(turning a bool -> string, etc aside from the data layer and view)
Patrick Clancy
@patrickclancy
yea.. it’s nice when the map prop is on a model. The existing app uses this radio section convention.
Alexis Abril
@alexisabril
gotcha
yeah, in this case it’d be cool either way
if it gets really complex(re-structuring an object), I typically have a viewmodel inbetween the actual model and whatever is using it
and then put all my conversions in there
I’m starting to get drawn back to the filters approach though

then you could do:

<input type=“radio” can-value=“{foo}” can-type=“boolean”/>
<input can-value=“{modifiedAt}” can-type=“date”/>
<input can-value=“{price}” can-format=“$dd.dd”/>

or something

those syntaxes were off the top of my head, don’t hold me to those ;)
Patrick Clancy
@patrickclancy
ahh interesting…. "a viewmodel inbetween the actual model” I’ll need to think about how to implement that. I like the can-type=“…” you’ve really got me thinking about the possible ways to skin the model cat.
Alexis Abril
@alexisabril
heh, I feel like I did a can-currency-value a while back for this type of stuff
I just want a normalized way to do conversions between the presentation/data layer elegantly
Gerard Finnerty
@halcyonandon
@alexisabril arent mustache helpers appropriate to use when you want the view format to be different than the data format? That's what I use for currency, date, et al. ...unless I'm misunderstanding the original question
Matthew Phillips
@matthewp
A viewModel is for the view. I would put it there.
dylanrtt
@dylanrtt
@halcyonandon if you are only displaying the data, mustache helpers are certainly appropriate, but if the data is being manipulated in the view, then you can do a lot more with the viewModel such as add setters and type conversions through the define plugin that you wouldn't necessarily want in your model, or at least that is what I am understanding
Chris Gomez
@akagomez
Is there a way to get compute A’s value from within compute B without creating a binding? @justinbmeyer @alexisabril
computeA.value seems to work.
Sorry to bug you.
Ilya Fadeev
@ilyavf
hey guys, how can i define a computed property in a child component and setup a reference to it in its parent component?
Ilya Fadeev
@ilyavf
var ChildVM = can.Map.extend({
  define: {
    myComputed: {
        get: function(){ return 'foo';}
    }
  }
});
can.Component.extend({
    tag: 'my-child',
    viewmodel: ChildVM
});
can.Component.extend({
    tag: 'my-parent',
    template: can.stache('<my-child myComputed="{getComputed}"></my-child>')
    viewmodel: {
        getComputed: null
    }
});
Chris Gomez
@akagomez
I was wrong earlier. It’s computeA.computeInstance.value.
dylanrtt
@dylanrtt
@ilyavf you can access the parent scope from the child to set properties like in this example:
http://jsbin.com/zoginopiwu/2/edit?html,js,console,output
but there might be a better approach to your problem if you could provide more info