Could use advice on organizing my Javascript, maybe using ES6 classes/modules(?)


Could use advice on organizing my Javascript, maybe using ES6 classes/modules(?)

So the app I'm working on is simple. I only need to handle some UI stuff – a user clicks a button, create ajax call to update db and then manipulate the UI a little. I think it's too basic to justify using Angular/Vue/etc for front end.

Here's a gist of what I have right now. I'd like to break this up. Separate files for Helpers, Offers, Carousel would be nice, but I'm not really sure the best approach here. Classes / Modules / neither?

http://ift.tt/2wVIYYF

Note: I don't think my usage of the MyApp class is correct – I probably shouldn't be creating an instance of the entire app 🙂 sounds dumb to me, but it's what I came up with that works. Maybe I should using modules? I don't really know. Any help here is much appreciated.

I'm using gulp and bebelify / browserify for ES6 stuff. I don't really have time to learn WebPack or whatever is cool these days.

The back end is built on top of a Code Igniter / Mongo DB back end, if that matters.

Submitted August 14, 2017 at 06:38AM by SoBoredAtWork
via reddit http://ift.tt/2w1LZua

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s