On Monday, March 23, 2015 at 11:20:12 PM UTC-4, Zhongcai Ng wrote:
>
> Am tagging custom properties on NodeJS socket objects. ie, socket.id,
> socket.someCustomProperty, etc.
>
> Like to ask if there's any prohibition imposed on custom property names.
> Am scared that I will break something unintentionally. With current and
> future versions of NodeJS
>
That's tough. It's a wide open namespace, and predicting the future is
impossible.
If you can use ES6 features, consider not putting the property on the
object, but instead using a WeakMap, and keeping your own stuff separate:
var wm = new WeakMap();
wm.set(socket, { yourproperty: value });
wm.get(socket).yourproperty
If not, namespace hard. Perhaps socket.yourmodulename.yourproperty?
socket['yourmodulename:yourproperty']?
Aria
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/9958558a-a4ea-4344-a498-90fe801db4d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.