tnhu / jsface

Small, fast, elegant, powerful, and cross platform JavaScript OOP library. Support main(), singleton, super call, private, mixins, plugins, AOP and more.
MIT License
301 stars 46 forks source link

Static constants feature #30

Closed fbudassi closed 9 years ago

fbudassi commented 9 years ago

I have been working with your library for a couple of months, but after trying to use $statics to add immutable constants and object literals grouping immutable constants to a project, I realized you could accidentally modify them.

I have made a simple implementation that requires ES5 to work. I hope you consider it interesting enough to be merged to the master branch of your library. It includes a simple sample and the corresponding unit tests together with the main implementation.

Don't hesitate to contact me if you think the code can be improved.

Regards, Federico Budassi.

tnhu commented 9 years ago

Hi Federico,

$const looks great. Can you refactor the code to make $const as a plugin instead (I made a comment on your change). I'll merge the code and update README.

Thanks, Tan

fbudassi commented 9 years ago

Hi Tan,

Done, $const moved to the Class.plugins.

Regards, Federico.

tnhu commented 9 years ago

Merged. This is a nice feature :+1: Thanks Federico!

Tan

fbudassi commented 9 years ago

You're welcome.

Federico.