Where communities thrive


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

    greenkeeper[bot] on core-js-3.3.1

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

  • Oct 13 14:49
    greenkeeper[bot] labeled #5375
  • Oct 13 14:49
    greenkeeper[bot] opened #5375
  • Oct 13 14:49

    greenkeeper[bot] on core-js-3.3.0

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

  • Oct 12 18:35
    matthewp commented #5358
  • Oct 12 18:15
    chasenlehara commented #5358
  • Oct 12 06:41

    greenkeeper[bot] on @octokit

    (compare)

  • Oct 12 06:39

    greenkeeper[bot] on @octokit

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

  • Oct 11 19:01
    m-mujica edited #5374
  • Oct 11 19:01
    m-mujica opened #5374
  • Oct 11 19:00

    m-mujica on update-deep-observable

    Update can-deep-observable to l… (compare)

  • Oct 11 18:55
    m-mujica edited #5365
  • Oct 11 18:54
    greenkeeper[bot] labeled #5373
  • Oct 11 18:54
    greenkeeper[bot] opened #5373
  • Oct 11 18:54

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

    fix(package): update can-deep-o… (compare)

  • Oct 11 16:42
    LakshanKarunathilake starred canjs/canjs
  • Oct 11 14:58
    greenkeeper[bot] labeled #5372
  • Oct 11 14:58
    greenkeeper[bot] opened #5372
  • Oct 11 14:58

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

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

Sunil George
@georgesunil81
Is there anything in CanJS that helps with this, or do I have to go via JQuery or plain JavaScript?
Christopher Oliphant
@RALifeCoach
@georgesunil81 My guess is that you will need to use jQuery or Javascript
Justin Meyer
@justinbmeyer
@Bajix change a lists's set? No, but you should be able to get dynamic subsets of items if you use cache-requests behavior
@RALifeCoach What about can-connect do you need me to look at?
looking up above
it seems you need the connection-store
behavior as well
Christopher Oliphant
@RALifeCoach
@justinbmeyer That was a while ago, I have everything working with that now
Justin Meyer
@justinbmeyer
yeah, I've been a bit busy the last 3 or so weeks
catching up on everything
Christopher Oliphant
@RALifeCoach
However, if you have a minute I am struggling with a steal-tools question
No problem, I know you guys are very busy.
Justin Meyer
@justinbmeyer
I'll meet you in the steal-tools room
steal room
Christopher Oliphant
@RALifeCoach
steal-tools or steal?
the question is posted in stealjs/steal
Adam L Barrett
@BigAB

Okay, here's what I want:
I want to be able to get all the methods on a DefineMap instance, that are not the methods provided by DefineMap (get,set,setup,serialize,...etc), I only want the methods defined in the propsDefinition object, or any propsDefinition object of it's from an already extended DefineMap class.

Is there a good way to get what I want?

My first thought is, see if there is any way to access the propsDefinition objects from the class/constructor function, sooo...
If you have an extended DefineMap constructor function:

const User = DefinedMap.extend({
  name: 'string',
  login(username, password) { ... }
})

Is there anyway to get the object passed to extend there from the User class?
If User was then extended:

const PrivilegedUser = User.extend({
  login(username, password) { ... },
  verifyRole(role) { ... }
})

Is there a way from the PrivilegedUser function to access both the object passed to as well as the one User.extend() passed to DefineMap.extend()?

From this example above, what I really want, is to end up with a list of method keys, in this case from PrivilegedUser I would want ['login', 'verifyRole']
Matthew Phillips
@matthewp
if(!DefineMap.prototype[methodName])
or
if(instance.__proto__[methodName])
Justin Meyer
@justinbmeyer
Please take our training session time survey: https://twitter.com/canjs/status/771026512057434112
Adam L Barrett
@BigAB
@matthewp No I want to get a list of the method names, I wont know them already
Justin Meyer
@justinbmeyer
@BigAB his suggestion was accounting for that
he implied a loop
you can do a for in loop of the instance.constructor.prototype
then check to make sure the property is .hasOwnProperty() on that object
Chris
@chrischrischris
Hi, Is there a way to determine if a control is currently bound to an element?
Justin Meyer
@justinbmeyer
I think a control adds to the element's data
if you're using jquery, $(element).data("control")
I think
controls
Chris
@chrischrischris
Perfect, thanks Justin!
Adam L Barrett
@BigAB
@matthewp @justinbmeyer Yeah, so that doesn’t quite get what I wanted, as there is still setup in there, and constructor, and I end up having to walk up and check the prototype chain to look for any more methods (from already extended constructors). So I take it we don’t hold onto those propertyDefinition objects anywhere then eh? That’s alright, I’ll look into a different approach.
Kevin Phillips
@phillipskevin
@BigAB when are you looking to do this? in your actual app? in a test?
Adam L Barrett
@BigAB
@phillipskevin Looking for a way in my can-react implementation, to copy (and bind) the methods defined on a DefineMap into the object to be passed as props to the connected component
https://github.com/BigAB/can-react/blob/master/src/can-react.js#L66
Currently I am copying (and binding) and property that is a function, but I figured that was excessive, as presumably, they would only be expecting to pass any methods the DefineMap had.. ..uh… defined.
To answer the “about to be asked” question, “Why not pass the whole DefineMap instance”, react throws a little warning if you try to pass anythign other than a plain object as props
Kevin Phillips
@phillipskevin
ok, thanks for explaining
I don’t have a better idea
if you figure out a different approach I’d be interested to hear it though
Adam L Barrett
@BigAB
I am considering putting the pressure on the other side, and only copying over methods defined in the React Components propTypes
This would force users to define their propTypes in the component, which though encouraged, is not enforced
Matthew Phillips
@matthewp
I think walking up the prototype chain is what you want to do
walk up the chain until you get to DefineMap and stop there
if your goal is to get a list of non-definemap functions that is
Adam L Barrett
@BigAB
@matthewp So you think i should just sort of blacklist setup which seems to always be there (as well as constructor)
Matthew Phillips
@matthewp
Yeah, sounds fine to me