Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 16 20:07
    matthewp commented #5384
  • Oct 16 20:06
    matthewp labeled #5384
  • Oct 16 20:06
    matthewp opened #5384
  • Oct 16 19:53
    matthewp opened #5383
  • Oct 16 16:23
    phillipskevin closed #4841
  • Oct 15 21:43

    phillipskevin on master

    Update dist for release (compare)

  • Oct 15 21:43

    phillipskevin on v6.1.1

    Update dist for release 6.1.1 (compare)

  • Oct 15 21:34

    phillipskevin on can-observable-mixin-1.0.2

    (compare)

  • Oct 15 21:34

    phillipskevin on master

    fix(package): update can-observ… Merge branch 'master' into gree… Merge pull request #5382 from c… (compare)

  • Oct 15 21:34
    phillipskevin closed #5382
  • Oct 15 21:34

    phillipskevin on can-make-map-1.2.2

    (compare)

  • Oct 15 21:34

    phillipskevin on master

    fix(package): update can-make-m… Merge pull request #5380 from c… (compare)

  • Oct 15 21:34
    phillipskevin closed #5380
  • Oct 15 20:30
    phillipskevin synchronize #5382
  • Oct 15 20:30

    phillipskevin on can-observable-mixin-1.0.2

    fix(package): update can-observ… fix(package): update can-simple… Merge pull request #5372 from c… and 2 more (compare)

  • Oct 15 20:30
    phillipskevin opened #5382
  • Oct 15 20:28

    phillipskevin on can-simple-map-4.3.3

    (compare)

  • Oct 15 20:28

    phillipskevin on master

    fix(package): update can-simple… Merge pull request #5378 from c… (compare)

  • Oct 15 20:28
    phillipskevin closed #5378
  • Oct 15 20:26

    phillipskevin on can-observable-mixin-1.0.1

    (compare)

Justin Meyer
@justinbmeyer
thanks!
I wonder if this is a problem with normal live-binding
as much as it is w/ two way binding
Chris Gomez
@akagomez
@justinbmeyer Yeah, I read it wrong. I think you’ve got it.
So as new <option>’s are rendered as children of a <select> element they should check their value against the can-value property of the parent <select>?
And add selected to the <option> element.
@justinbmeyer You mean if I rebuild the list of <option> tags with JS in general, will the selected option be marked selected?
Justin Meyer
@justinbmeyer
I don't think it will
I'm not sure
but it should be
Chris Gomez
@akagomez
@justinbmeyer Doesn’t look like it: http://jsbin.com/bazavuxiro/edit?html,js,output
Justin Meyer
@justinbmeyer
what is that supposed to show?
oh
Chris Gomez
@akagomez
If the list of options is rebuilt with the same values the selected element is not shown as selected.
Justin Meyer
@justinbmeyer
it works for me
Chris Gomez
@akagomez
Really? Browser?
Justin Meyer
@justinbmeyer
nm
had to hit autorun
yeah
this is the problem
I suppose that live-binding should check if the parent element is a <select>
and make sure the value is maintained if possible
Chris Gomez
@akagomez
@justinbmeyer If you detach and append the exact same <option> elements, it shows the correctly selected option item: http://jsbin.com/tupodanihu/1/edit?html,js,output
Although I’m not really surprised by that now that I think of it.
Justin Meyer
@justinbmeyer
yeah, b/c of Selected
Chris Gomez
@akagomez
@justinbmeyer Shouldn't registered can.view.attr functions be run when the attribute is added post-render, like this: {{#if panelB}}st-panel-resizable{{/if}}
Matthew Phillips
@matthewp
I have a list of 5 items
I call .destroy() on one of them
I would expect the list to be 4
where is the logic where it gets spliced out of the list?
dylanrtt
@dylanrtt
Matthew Phillips
@matthewp
i think you're right
thanks
espretto
@espretto
hi there, i'm new to gitted and canjs, anybody home?
Chris Gomez
@akagomez
Welcome.
espretto
@espretto
great! could you help me with some canjs basics?
Chris Gomez
@akagomez
I’ll do my best.
espretto
@espretto
i've been working with emberjs and knockoutjs but am still struggling atm with canjs observables/computed attributes - hands on: how do you typically wire up model requests depending on some observable e.g. the route?
as suggested in the docs i created a computed representing the request deferred
can.Map.extend({
   model: null,
    state: 'pending', 

    promise: compute(function () {
      var scope = this,
          promise;

      promise = ConfigModel
        .findOne({
          version: scope.attr('version'),
          title: scope.attr('panoTitle')
        })
        .then(function (model) {
          scope.attr('model', model);
        })
        .always(function () {
          scope.attr('state', promise.state());
        })
        .promise();

      scope.attr('state', promise.state());

      return promise;
    })
});
problem is the promise doesn't evaluate its dependencies until someone binds to it
Chris Gomez
@akagomez
@espretto That’s by design.
espretto
@espretto
makes sense, now..

if i rewrite state to depend on promise

...
state: compute(function () {
  return this.attr('promise').state();
});
...

the binding won't get set up. i intend to request {{state}} in my stache template to trigger the request - if that's how it's supposed to be.

return this.promise().state() won't setup the dependency either.
neither does stache's live-binding
espretto
@espretto
the only solution to force computed properties to evaluate their dependencies was to add
Component.extend({
  ...
  scope: MapCtr,
  events: {
    '{scope} promise': noop,
    ...
  }
  ...
});
Chris Gomez
@akagomez
So this.attr(‘promise’) didn’t call the promise’ compute function?
espretto
@espretto

yes it did, however, state does not revaluate itself when promise does. i was expecting any call to .attr would bind the computed being created to that attribute, but it doesn't. which is why i tried sth. like

Component.extend({
  ...
  scope: {
    promise: '...',
    state: compute(function (newState) {
      if (arguments.length) return newState;
      var self = this;
      self.bind('promise', function (evt, newPromise) {
        newPromise.always(function () {
          self.attr('state', this.state());
        })
      })
    })
  }
  ...
});

but that doesn't work either.

i think i basically try to achieve sth. like amd can/list/promise does