The conversation will go about JavaScript and nothing more.
I have long suffered from the idea that often I have to transfer functions from a project to a project, and since I don’t really like files like common.js or utils.js, where everything is piled up in a heap, sometimes I even have to keep these functions in different files. This is the essence of the problem. It would be desirable to have greater portability, while not cluttering up the global scope and, accordingly, I do not use function prefixes.
Recently I was watching Java and I really liked how the packages are connected there, and I thought that this might help me in solving the problem. I am not a master in JavaScript and Java, and there will be a lot of incorrect constructions and it is durable, but I am genuinely interested in the opinions of people about the idea. I called the project jpack by analogy with jQuery, but I want to note that this is not a competitor to jQuery - jpack, which solves another problem.
Repository:
github.com/arturgspb/jpack')
There are not enough examples and packages yet - simply because it is possible and there will be no sense to further develop it if the
matter of perdition is not interesting for people.
For those who are too lazy to raise the project:
<script data-main="scripts/main" src="../js/jpack.js"></script> <script type="text/javascript"> jpack.setPackagesPath('../js/packages'); jpack.load('jpack/utils'); jpack.load('jpack/system/out'); </script>
And in the
body write:
<script type="text/javascript"> jpack.run(function(){ var date1 = '2012-01-02' var date2 = '2012-02-02'; var counter = jpack.utils.datetime.getDateDiff( new Date(date1), new Date(date2) ); jpack.system.out.println(' : ' + date1 + ' ' + date2 + ':'); jpack.system.out.println(': ' + counter.week); jpack.system.out.println(': ' + counter.day); }); </script>
For the conclusion. I understand that uploading scripts with different files is not optimal - the project is still very young and I wanted to show a working model and not an optimal structure. I would like to know the opinions on the model of the library. How to improve the very essence.
Thanks for attention.