mardi 4 novembre 2014

Javascript class - how to make properties required and optional


Vote count:

0




I'm building a event tracking api and need to provide a JS class with a list of properties of which some of them will be required and some optional. Also, no new properties should be added.


Once the client instantiates and passes the object based on the class, I will be serializing the object and sending it as query string. I already have this part but not sure how to restrict the client from creating new properties.


How do I go about designing the class in JS?



asked 31 secs ago







Javascript class - how to make properties required and optional

Aucun commentaire:

Enregistrer un commentaire