symfony-cmf / tree-browser-bundle

Integrates javascript tree browser with PHPCR and PHPCR-ODM.
https://cmf.symfony.com
Other
22 stars 17 forks source link

[JS] Code refactoring #141

Open ElectricMaxxx opened 7 years ago

ElectricMaxxx commented 7 years ago

For a better working with the javascript code i would suggest some refactorings.

More files

As we concat the complete code into one file it wouldn't be that problem to divide the code into more files. So i would suggest some little services for each callback we put into the options object of fancytree. Doing so we can handle each part separate and could unit test most of them (mostly we do transformations on data.node)

type hinting

As fancytree has a feature rich api and we transport a specific model through our api i would suggest to use some kind of typehinting. In typescript i use (DefinitelyTyped)[https://github.com/DefinitelyTyped/DefinitelyTyped] no clue if ES6 has something equalt, but would be a reason for me to move into typescript (at the end it is an other converter only)

wouterj commented 7 years ago

As we concat the complete code into one file it wouldn't be that problem to divide the code into more files. So i would suggest some little services for each callback we put into the options object of fancytree. Doing so we can handle each part separate and could unit test most of them (mostly we do transformations on data.node)

Not sure how exactly, but definitely +1 on making the files a bit less big (and thus more structured).

As fancytree has a feature rich api and we transport a specific model through our api i would suggest to use some kind of typehinting. In typescript i use (DefinitelyTyped)[https://github.com/DefinitelyTyped/DefinitelyTyped] no clue if ES6 has something equalt, but would be a reason for me to move into typescript (at the end it is an other converter only)

Not sure about this one. One thing I know, if we're going to switch to typescript, I'll stop contributing to the JS code in this bundle ;)