I have experience, forks in places forks shouldn't be hurt.
Thanks to @ASPCA and @WagsandWalks Sunny and I are finally fostering our 1st pitbull! Meet Ginger. I'm in LOVE.ā¦ https://twitter.com/i/web/status/839604439094710272
@OliverSalzburg All major mobile targets - iOS and Android - supports all common ES6 feature, so IE is the main problem. Which is a hindrance that would prevent you from updating to modern web technologies like flexbox, notification, touch, or simple quality-of-life improvements like Element.remove.
Joking aside, this is the wrong place for just popping in and getting a job. People that get jobs from this room do so because they were regulars and built a rapport with someone that then later had an opening.
So I have the navigation for my web app just load a new html (or php) page into the content div of my website to avoid reloading. To avoid any interaction from functions/event listeners/variable from one HTML to another should I just wrap all the JS on each html page in function pageName() {insert js here}; then call pageName() after the function? It seems to work fine and prevent other pages from accessing the variables inside the function but I don't know if there are any unnoticed problems
Target has an internal framework built up on top of angular 1.5 that we're supposed to use for internal apps, but it's a nightmare. I very quickly veto'd it and am leaning towards react for our project
Okay so an example that I use (using the dreaded jquery and a plugin called dataTables) is globally defining var statsDataTable; so that I can put statsDataTable = $("#id").dataTable({options}); in a function that can be called from anywhere, and doesn't have to check if statsDataTable needs to be defined for the first time or is already defined
actually, lets back up. How does one of your .js files get into the browser?
- Included directly in a <script tag>
- concatenated into a big .js and that is in a <script> tag
- webpack, browserify or another bundler
- other?
For right now, the first one (directly in script). I was planning on looking moving each pagesjs into a seperate .js file when I am finished but I'm not sure if it would make things much better.
@Alesana I highly recommend a module loader / bundler. I use webpack. It's extremely flexible, but there are simpler options if you have issues with it.
But.. I'd need to see code to help you migrate to proper modules instead of a bunch of loose files and dependencies. It may be a lot of work, but it is NEEDED if your project will continue to grow.
a lot of work now, or an impossible amount of work in the future
@Luggage I actually haven't looked into any module loaders. I am planning on making my app available for distribution to where each would upload it to their own server, would they also need to install it with a module loader to make it work on their own server?
but modules loaders (like webpak) and be told to package up all your files to be included in another app without them needed to care what you used to make the library. So, no, they won't need a module loader.
@Sheepy No, they don't. If you were trying to say that the latest off-the-shelf versions of the respective products are likely to support ES6, then, yes. But taking that and oversimplifying it as "Android and iOS can do ES6" is simply wrong
Go learn a module loader / bundler with a small sample project if yours is too complex to learn on. webpack or browserify. The structure you learn here is not specific to them, they are jsut tools that allow you to use the 'right' code structure, since JS in the browser doesn't give you those tools out of the box.
Imagine.. you have a deep organized directory structure with files referencing each other. Then you run this tool, it looks at all the files, sees "ohh, your app uses '../some.js', i'll include that in the big .js file I made for the browser"
There are certain situations where I echo a PHP variable into a <script> tag. It is not user-provided, so it's not a security flaw, but it wouldn't work in a .js file
Also, this step, while seemingly 'extra work', is a point where you can apply transforms to he JS. Use modern JS in your code but have it downgraded to what your users's browsers support.
@Alesana ohh, ig you are having your php generate .js then.. that'll need to be changed. These tools I speak of are all about JS and don't run in php
user1596138
@Alesana For quick testing you could still echo it to a global variable and reference from your .js. Tho you would want to look into serving that data via Ajax for the long term
If your app is a bunch of separate html files generated by php (not a single-page-app) these things will be more complex. You'll have to separate the plain .js common files from the php-generated code.
This is why the community is moving toward all-JS clients that only talk to the server through an API. Having a mixed PHP/JS front end is very complex.
If it's one line, that'll make re-factoring much simpler.. and possible.
@SterlingArcher got to see Make Them Suffer and Betraying The Martyrs on sunday
user1596138
@Alesana You really want to use an API. But to get you up and running and into modules, just echo your php shit to window.phpShit and then in your .js reference window.phpShit lol
It is var phpobj = <?php echo json_encode($jsobj); ?>; which would contain an object of variables such as an id which would be used in an Ajax call to get information from the ID
@ALSTRA Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
Jhawins right. that's what we're saying. He (or she?, Alesana) says all his pages use window.phpobj to get thair data. ssube suggested externals: ['phpobj'] to let that keep happening.
user1596138
Move your entire app to jQ UI stop listening to these plebs
Can you guys help me find an example for my boss?, I am trying to give an example of a site that uses select boxes and inputs in sentence format. Like a semantic form, but google gives me garbage, I knopw I have seen examples before.