Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 26 19:04
    cherifGsoul synchronize #5509
  • Oct 26 19:04

    cherifGsoul on upgrade-can-ajax

    Update nodejs version (compare)

  • Oct 23 19:03
    cherifGsoul synchronize #5509
  • Oct 23 19:03

    cherifGsoul on upgrade-can-ajax

    Move can-ajax tests to dev only (compare)

  • Oct 23 16:37
    cherifGsoul commented #5510
  • Oct 22 16:04
    yayan19 starred canjs/canjs
  • Oct 20 02:45
    AkiaCode starred canjs/canjs
  • Oct 19 14:39
    hkutcher opened #5510
  • Oct 19 14:38
  • Oct 17 10:58
    Fatima-Usf starred canjs/canjs
  • Oct 15 21:18
    naskio starred canjs/canjs
  • Oct 12 22:08
    cherifGsoul synchronize #5509
  • Oct 12 22:08

    cherifGsoul on upgrade-can-ajax

    xvfb services (compare)

  • Oct 12 22:07
    cherifGsoul edited #5509
  • Oct 12 22:06
    cherifGsoul opened #5509
  • Oct 12 22:01

    cherifGsoul on upgrade-can-ajax

    Update can-ajax version (compare)

  • Sep 29 13:17
    ko25july starred canjs/canjs
  • Sep 21 17:41
    cherifGsoul assigned #5508
  • Sep 21 17:39
    cherifGsoul opened #5508
  • Sep 18 19:32
Brad Momberger
@bmomberger-bitovi
DefineMap.extend("NameForThisMap", { ... })
Nico R.
@nriesco
otherwise I’m extending the whole DefineMap class for the whole app?
Brad Momberger
@bmomberger-bitovi
no, it just doesn't change the name on the constructor
If you extend a DefineMap without a name, it's still got "DefineMap" as the name
which can make it harder to track down "the definition for ok on DefineMap"
can-component actually generates names for the DefineMap subclass if you pass plain objects (i.e. DefineMap prototypes) in as the viewModel
I'm not saying to do that. I am saying, when you extend a DefineMap, it's good practice to give the extended map a name.
Nico R.
@nriesco
oh, I see you refer to the warning I got, thanks a lot, that shuld definitely make thinks easier to track
Morgan Heimbeck
@Xitstrategies
@justinbmeyer I am just waiting to hear from you on canjs/can-ajax#13 If there is someone who can give me a brief run down or document on what all I need to do to document my pull request change, let me know.
Brad Momberger
@bmomberger-bitovi
It should suffice to add xhrFields as a param to the options object, if you can also link to somewhere that explains the format.
Morgan Heimbeck
@Xitstrategies
@bmomberger-bitovi thanks!
Jim O'Harra-Sutton
@Psykoral
Anyone know the new CanJS 3 version of can/map/delegate? https://v2.canjs.com/docs/can.Map.prototype.delegate.html . I'm trying to do essentially the same thing... Give it a Map to watch, and if this particular property changes, do stuff
Brad Momberger
@bmomberger-bitovi
We were shockingly uncreative about some of these package renames
Jim O'Harra-Sutton
@Psykoral
right, but it says it's deprecated
Brad Momberger
@bmomberger-bitovi
All of can-map is deprecated.
Jim O'Harra-Sutton
@Psykoral
uncreative isn't a bad thing by the way, it is what it says it is :)
right, I guess I'm trying to find "whatever is the new way" to watch a Map value change
Brad Momberger
@bmomberger-bitovi
What you're doing with the changed value matters.
Jim O'Harra-Sutton
@Psykoral
I merely want to listen for it to be changed
Brad Momberger
@bmomberger-bitovi
If it's in another Map, using can-map-define or upgrading to can-define/map/map will let you define a getter that listens to that map's changes.
Jim O'Harra-Sutton
@Psykoral
AH ha, there we go... where would I find info on that right there
specifically listening to the value of an item in another map, exactly
Brad Momberger
@bmomberger-bitovi
For can-define/map/map (this would require some migration work): https://canjs.com/doc/can-define/map/map.html
Jim O'Harra-Sutton
@Psykoral
I am using can-define/map/map yeah
Brad Momberger
@bmomberger-bitovi
If you want to do this outside of a map's property, you can use can-compute instead: https://canjs.com/doc/can-compute.html
The general idea is pretty much the same between a getter on a defined map or a getter-setter in can-compute: Any other compute or property of a can-map or DefineMap that is read by the getter will cause the value to update when it changes.
Jim O'Harra-Sutton
@Psykoral
I want to have one Map A look at a property of a Super Map,and when that value changes do some things in Map A
Brad Momberger
@bmomberger-bitovi
So if you have a DefineMap A, and a DefineMap B (which could be coming from can-connect/super-map)...
And A.foo is a getter that reads the value of B.bar...
And (this is important) A.foo is bound
Then the getter for A.foo is called every time B.bar is updated.
In practice, that looks like this:
var B = new DefineMap({ bar: "some string" });
var AC = DefineMap.extend({ foo : { get() { return B.bar } } });
var A = new AC();
A.on("foo", function() {});  // <- this is binding.  You don't need to do this if a Stache is reading A.foo
Jim O'Harra-Sutton
@Psykoral
I'm probably not using the "getters" like I should be. Truth be told I'm still figuring out the syntax of the new (to me) DefineMap
Ah OK, let me try that
Brad Momberger
@bmomberger-bitovi
A more generalized form might put B in A as a property:
var B = new DefineMap({ bar: "some string" });
var AC = DefineMap.extend({ b: {}, foo : { get() { return this.b.bar } } });
var A = new AC({ b: B });
A.on("foo", function() {});
This is analogous to A being a view model, and containing B as a data model.
Jim O'Harra-Sutton
@Psykoral
cool, I've got some other errors to dig through but I think that worked
thanks again!
Brad Momberger
@bmomberger-bitovi
You're welcome. Good luck with your other errors.
Jim O'Harra-Sutton
@Psykoral
Do I have to specifically use a setter in order to make the getters "listen and react" to the changed value?
Brad Momberger
@bmomberger-bitovi
No. Setters can be used for translating inputs or other side effects, but they're not strictly necessary. You can have a getter without a setter.
Jim O'Harra-Sutton
@Psykoral
because right now, based on your sample above as reference, I'm just setting B.bar = null and B.bar = 'a thing' and thought that would be enough to make the getters do their updates
Brad Momberger
@bmomberger-bitovi
It should be. Do you see the getter effect happen when you read A.foo directly?
Jim O'Harra-Sutton
@Psykoral
my eqiv of A.foo is in a stache, so no that HTML isn't showing when I change the value of B.bar
Brad Momberger
@bmomberger-bitovi
OK. so if B is a DefineMap, was B.bar defined on its prototype OR present on the argument when B was instantiated?
This is important because we do all the live listening and side effect stuff on DefineMaps using JavaScript property definitions. It may or may not surprise you to know, that DefineMap can't act on properties it hasn't been informed about.