Can.Component Private Members

Is it possible for a can.Component to have private members that are for internal use only?

What do you mean by private members?

Is it possible for a can.Component to have private members that are for internal use only?

This question should really be asking if there’s a way for a can.Map to have a private property or method. can.Map is really the core type of which Component is built around.

There’s no way of doing this presently as the versions of JS CanJS supports don’t really allow it. Perhaps when Symbols become ubiquitous, we can tackle it.

However, you can use the tried and true convention of making private methods and variables start with _.

Yes, that is the precise question I was trying to ask.

can.Map with private properties would be the shizzz (three z’s)!

Prepending underscores stinks, but I hear you…

1 Like