Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Valeyard
Mar 30, 2012


Grimey Drawer

Wheany posted:

Is the data returned from page B a complete html file, or just a fragment? $("#result").html(data); sets the innerHTML of the element whose id is "result" to the html that is returned, so that might not work if it's a complete page and not just a fragment.

You do have some html element on the page with id="result", right?

Yeah it was a complete page, rather than a fragment, so I figured that wouldn't work.

And I did have an id element like that, but I guess it wouldn't have worked anyway.

Sorry to have wasted your time, but I have fixed it by not using the jQuery at all and just using hidden inputs which seems to work ok, I need a break

Adbot
ADBOT LOVES YOU

IronSaber
Feb 24, 2009

:roboluv: oh yes oh god yes form the head FORM THE HEAD unghhhh...:fap:

fakemirage posted:

I can spot two issues in your validation function that will stop it from running.
Line 85:
code:
if((phoneNumber.value.match(phoneno))
Is missing a closing parentheses (or got one opening parentheses too many).

Line 80:
code:
var phoneNumber =  document.getElementById("phone").value;
This is combination with line 85 above means that you're trying to get the value out of the value, i.e. it's the same as writing:
code:
document.getElementById("phone").value.value.match(phoneno)

Cool, thanks. I'll make these changes and see if it runs.

*E* Nope, still not working for me. Do I need to give the function a value to return? Or possibly pass? Agh, I'm so confused.

IronSaber fucked around with this message at 20:51 on Mar 17, 2014

fakemirage
Nov 6, 2012

Can't see the haters.

IronSaber posted:

Cool, thanks. I'll make these changes and see if it runs.

*E* Nope, still not working for me. Do I need to give the function a value to return? Or possibly pass? Agh, I'm so confused.
The phoneCheck function itself should work if you corrected the lines highlighted. As for the rest of the script, there's one thing I've noticed specifically:

You call document.getElementById in your head-tag (line 62-69), before the browser has gotten to the body-tag (i.e. you're trying to get elements that doesn't exist yet).

Since you don't actually use them anywhere it would be safe just to remove them, and get your script running (with the assumption that everything else is working, like the GetCookie function which I can't find in your pastebin, but you call in your script) or just run it later when the body and DOMTree has finished loading (like you've done with updateDisplay). Just note that the value you get is the value of the field as the line is executed; so if you retrieve the value of the element firstName as the document has just finished loading, the variable you stored the first name in will always be empty (since that's the value it gets by default).

fakemirage fucked around with this message at 21:32 on Mar 17, 2014

IronSaber
Feb 24, 2009

:roboluv: oh yes oh god yes form the head FORM THE HEAD unghhhh...:fap:

fakemirage posted:

The phoneCheck function itself should work if you corrected the lines highlighted. As for the rest of the script, there's one thing I've noticed specifically:

You call document.getElementById in your head-tag (line 62-69), before the browser has gotten to the body-tag (i.e. you're trying to get elements that doesn't exist yet).

Since you don't actually use them anywhere it would be safe just to remove them, and get your script running (with the assumption that everything else is working, like the GetCookie function which I can't find in your pastebin, but you call in your script) or just run it later when the body and DOMTree has finished loading (like you've done with updateDisplay). Just note that the value you get is the value of the field as the line is executed; so if you retrieve the value of the element firstName as the document has just finished loading, the variable you stored the first name in will always be empty (since that's the value it gets by default).

I see. But the function runs only after onBlur is invoked from the phone number field. I would assume that after a number is entered and someone moves on to another field to enter, the onBlur would run the phoneCheck() function and grab the data currently in the field.

The getCookie function is from another page in this project; it's supposed to take the order of a pizza you enter and carry it over to this page. I will have to write up another function to take the customer data from this page and store it in cookies to take to the final Order Confirmation page along with the pizza cookies.

Heh... pizza cookies.

fakemirage
Nov 6, 2012

Can't see the haters.

IronSaber posted:

I see. But the function runs only after onBlur is invoked from the phone number field. I would assume that after a number is entered and someone moves on to another field to enter, the onBlur would run the phoneCheck() function and grab the data currently in the field.
That's absolutely correct, you'll get what is currently entered in the phone number field when you call phoneCheck.

I was commenting on lines 62 through 69, that doesn't run in the phoneCheck function.

IronSaber
Feb 24, 2009

:roboluv: oh yes oh god yes form the head FORM THE HEAD unghhhh...:fap:

fakemirage posted:

That's absolutely correct, you'll get what is currently entered in the phone number field when you call phoneCheck.

I was commenting on lines 62 through 69, that doesn't run in the phoneCheck function.

Oh, so you mean that the var phoneNumber = document.getElementById("phone"); should be inside the function itself?

*E* Holy poo poo! It works! Fakemirage, you are my hero. Thank you for helping me out! :patriot:

IronSaber fucked around with this message at 22:27 on Mar 17, 2014

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



I've been asked to automate a simple "log in to dashboard, click button, accept download, repeat from step 2" workflow on a site that's extremely AJAX heavy and complicated, so I figured I'd just slap it together with casperjs/phantomjs and it'd be a fun afternoon getting deeper into those projects than "I read a blog article one time". Indeed it was easy to get my script to the point where it was requesting and actually receiving the report - as a Content-Disposition: attachment to a POST response, which is something phantom just can't cope with very well unless you go get one obscure branch and build that. After a rousing of morning cleaning up broken build scripts and waiting for OpenSSL and Qt to compile, I have a fancy newfangled phantom build that just falls on its face instead of completing the login step. Now I'm recompiling once more with feelingdebug symbols and wile I wait, I figured I'd ask you guys if there's a better way.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Sounds like something that should be handled server-side. Deal with the form inside your one-page app, then provide a link to another page that serves a file, perhaps? Maybe add a parameter to the file serving page to require a disposable key.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



I think you misunderstand: I'm scraping content from someone else's server.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Munkeymon posted:

I think you misunderstand: I'm scraping content from someone else's server.

Have you considered just using Greasemonkey (Tampermonkey on Chrome)? It seems like almost exactly what you want.

IronSaber
Feb 24, 2009

:roboluv: oh yes oh god yes form the head FORM THE HEAD unghhhh...:fap:
Now I'm having more issues getting this project up and running, and I dunno if anyone will be able to respond in time to help me.

So here's the code for all three pages of my project:

index.html: http://pastebin.com/w73LGp6Z
custInfo.html: http://pastebin.com/eL3Bgba8
summary.html: http://pastebin.com/cbyrZFsY

I'm stuck on a couple areas:
-Need to get the subtotal function to dynamically display all combinations of cost of crust and toppings
-Need to get it all stored as cookies and transferred to the next page and the page after that
-Need to get the custInfo page to run the inputCheck upon clicking the submit button (I know this requires the 'onsubmit' function, but I have no idea where to place it)

I have several more functions that need to be put in, but I don't want to make anyone else do this project for me.

fakemirage
Nov 6, 2012

Can't see the haters.

IronSaber posted:

I'm stuck on a couple areas:
-Need to get the subtotal function to dynamically display all combinations of cost of crust and toppings
-Need to get it all stored as cookies and transferred to the next page and the page after that
-Need to get the custInfo page to run the inputCheck upon clicking the submit button (I know this requires the 'onsubmit' function, but I have no idea where to place it)
Going through these in reverse order:
- onsubmit is something you can add to your form element, probably like this: <form name="custInfo" action="summary.html" method="post" onsubmit="return inputCheck();">. Remember to use return if you want inputCheck to be able to stop the submission if the data isn't valid.
- Storing the form in cookies is something you'll probably do after validating that the data is correct, so maybe it should be done in the inputCheck method, or a function that you at least run when you submit the form. If you're unsure how to save and read cookies, there are plenty of tips and complete functions to find through google.
- For the dynamic subtotal, you should probably use the price array, iterate over it and get the sum. (example).

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Subjunctive posted:

Have you considered just using Greasemonkey (Tampermonkey on Chrome)? It seems like almost exactly what you want.

That was a good thought, but, after looking into it, I wasn't able to find any way to change the location or name of the file downloaded*. That's a problem when all of the files are named something like date_range.csv and all get saved to the same place. I did eventually get a build of phantom working that gave me access to the request data and didn't crash all over the place, so it turned out OK in the end.

* I admit it's possible that I didn't look hard enough, but I did look

Brave GNU World
Nov 1, 2013

by Cyrano4747

Munkeymon posted:

That was a good thought, but, after looking into it, I wasn't able to find any way to change the location or name of the file downloaded*. That's a problem when all of the files are named something like date_range.csv and all get saved to the same place. I did eventually get a build of phantom working that gave me access to the request data and didn't crash all over the place, so it turned out OK in the end.

* I admit it's possible that I didn't look hard enough, but I did look

If you just want to save it client side there's the html5 download attribute for Chrome/Firefox and msSaveBlob for IE10+; IE9 can only save text/html using execCommand.

Xik
Mar 10, 2011

Dinosaur Gum
I'm not sure which of the JS/Web dev threads to put this in, so here goes:

I'm looking for a minimal unit testing suite/framework. At the moment I'm still writing stuff that is manageable in a single file, wrapped within a single anonymous function. I'd really like it if I could just write a bunch of unit tests in another single file to test all the functions that don't rely on the DOM. Maybe pass both files (or just the test file) to a node.js cli tool. Then it runs the tests and poops out the test results to the console.

Basically, just change what I currently do:

code:
clear && jslint myapp.js
to:

code:
clear && jslint myapp.js && testtool myapp.js mytests.js
or something. My use case for JavaScript in the foreseeable future is small and simple. Mostly greasemonkey scripts or small single page "apps" using no external libraries. I would just like the extra confidence unit testing can give in some circumstances.


e: Welp, probably should have googled better before posting, maybe mocha is what I want?

Xik fucked around with this message at 11:11 on Mar 22, 2014

Osmosisch
Sep 9, 2007

I shall make everyone look like me! Then when they trick each other, they will say "oh that Coyote, he is the smartest one, he can even trick the great Coyote."



Grimey Drawer

Xik posted:

I'm not sure which of the JS/Web dev threads to put this in, so here goes:

I'm looking for a minimal unit testing suite/framework. At the moment I'm still writing stuff that is manageable in a single file, wrapped within a single anonymous function. I'd really like it if I could just write a bunch of unit tests in another single file to test all the functions that don't rely on the DOM. Maybe pass both files (or just the test file) to a node.js cli tool. Then it runs the tests and poops out the test results to the console.

Basically, just change what I currently do:

code:
clear && jslint myapp.js
to:

code:
clear && jslint myapp.js && testtool myapp.js mytests.js
or something. My use case for JavaScript in the foreseeable future is small and simple. Mostly greasemonkey scripts or small single page "apps" using no external libraries. I would just like the extra confidence unit testing can give in some circumstances.


e: Welp, probably should have googled better before posting, maybe mocha is what I want?

It might be a bit of overkill for your current needs, but I have been extremely happy with a Karma/Jasmine combo.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Brave GNU World posted:

If you just want to save it client side there's the html5 download attribute for Chrome/Firefox and msSaveBlob for IE10+; IE9 can only save text/html using execCommand.

None of which I could use AFAICT because these files are delivered as attachments to POST responses, not links as actual links that I could manipulate in the DOM. I think Opera might have an event user scripts can hook to look at requests, but I couldn't find anything for Chrome. Actually, it was a pain in the rear end finding anything about user scripts for Chrome that wasn't horribly outdated.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Munkeymon posted:

None of which I could use AFAICT because these files are delivered as attachments to POST responses, not links as actual links that I could manipulate in the DOM. I think Opera might have an event user scripts can hook to look at requests, but I couldn't find anything for Chrome. Actually, it was a pain in the rear end finding anything about user scripts for Chrome that wasn't horribly outdated.

Sometimes it's a bit of a pain in the rear end trying to use user javascript files on Chrome compared to Opera (<15). On opera, they explicitly have higher privileges than in-page scripts and you can freely access the global state of the page. On Chrome they're too concerned about "sandboxes" and "security" to let me do that :mad:

Brave GNU World
Nov 1, 2013

by Cyrano4747

Munkeymon posted:

None of which I could use AFAICT because these files are delivered as attachments to POST responses, not links as actual links that I could manipulate in the DOM. I think Opera might have an event user scripts can hook to look at requests, but I couldn't find anything for Chrome. Actually, it was a pain in the rear end finding anything about user scripts for Chrome that wasn't horribly outdated.

You don't need actual links, you just create an element in javascript and set the href to the file type/data and download to the file name, add it as an invisible element to the DOM, call click on it and get rid of it.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Brave GNU World posted:

You don't need actual links, you just create an element in javascript and set the href to the file type/data and download to the file name, add it as an invisible element to the DOM, call click on it and get rid of it.

How do you get that to send a POST? I think he'll need XHR for that, which is also an option. The content-disposition stuff is such a mess. :-(

Xik
Mar 10, 2011

Dinosaur Gum

Osmosisch posted:

It might be a bit of overkill for your current needs, but I have been extremely happy with a Karma/Jasmine combo.

I got things setup with mocha (testrunner) and chai (assertions), but had to settle on using the html reporter instead of the cli. Unless I'm missing something obvious, there is no sane way to use my script as a module in node without making GBS threads it up with an export statement. So writing tests and running mocha via the command line is a no go for scripts intended for the browser.

I've got a (probably dumb) question. Can I rely on the browser blocking when loading a resource via the script tag? I read about the html5 async attribute for the script tag and now it has me worried.

In the following snippet will MYMODULE always be available? Can I always rely on that? Is there a more appropriate pattern for doing this without moving the original call into the script itself?

code:
var MYMODULE = (function () {
    // do a whole bunch of stuff
    return the_object_with_all_the_stuff;
}());
code:
<script src="mymodule.js" type="text/javascript"></script>
<script type="text/javascript">
  MYMODULE.init();
</script>

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Xik posted:

I've got a (probably dumb) question. Can I rely on the browser blocking when loading a resource via the script tag? I read about the html5 async attribute for the script tag and now it has me worried.

In the following snippet will MYMODULE always be available? Can I always rely on that? Is there a more appropriate pattern for doing this without moving the original call into the script itself?

code:

var MYMODULE = (function () {
    // do a whole bunch of stuff
    return the_object_with_all_the_stuff;
}());
code:

&lt;script src="mymodule.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
  MYMODULE.init();
&lt;/script&gt;

Yes, that's safe unless you make the first script tag async explicitly. Note that script tags may be *fetched* ahead of script execution flow, as a networking optimization, but in the absence of async they must be *executed* in page/DOM-insertion order.

Every site in the world that uses out-of-line JS scripts relies on this, so you're safe.

Xik
Mar 10, 2011

Dinosaur Gum
Thanks Subjunctive. I'm glad there is at least one thing about the DOM that makes sense. :sun:

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Xik posted:

Thanks Subjunctive. I'm glad there is at least one thing about the DOM that makes sense. :sun:

Not too much, though: we tried to keep people on their toes.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Wheany posted:

Sometimes it's a bit of a pain in the rear end trying to use user javascript files on Chrome compared to Opera (<15). On opera, they explicitly have higher privileges than in-page scripts and you can freely access the global state of the page. On Chrome they're too concerned about "sandboxes" and "security" to let me do that :mad:

Yeah, I'm gonna miss that when 12 finally gets too far behind the times to justify using. RIP Opera's good days :(

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Subjunctive posted:

How do you get that to send a POST? I think he'll need XHR for that, which is also an option. The content-disposition stuff is such a mess. :-(

Tried that, actually. I could never even get a repeated request to work, even when I had Fiddler replay it so I knew it was the same.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Munkeymon posted:

Yeah, I'm gonna miss that when 12 finally gets too far behind the times to justify using. RIP Opera's good days :(
Opera's been WebKit-based for awhile now - where are you afraid of it falling behind?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Misogynist posted:

Opera's been WebKit-based for awhile now - where are you afraid of it falling behind?

Opera 12, not the entirely unrelated blink-based browser.

The Insect Court
Nov 22, 2012

by FactsAreUseless
I don't know if this should go in the Clojure thread or here, but for anyone fairly familiar with it, does Clojurescript eliminate any major Javascript warts(that Coffeescript doesn't)? I've played around with it a bit, enough to get the basic syntax down, but as of yet there hasn't been any wow moments.

Xik posted:

I'm not sure which of the JS/Web dev threads to put this in, so here goes:

I'm looking for a minimal unit testing suite/framework. At the moment I'm still writing stuff that is manageable in a single file, wrapped within a single anonymous function. I'd really like it if I could just write a bunch of unit tests in another single file to test all the functions that don't rely on the DOM. Maybe pass both files (or just the test file) to a node.js cli tool. Then it runs the tests and poops out the test results to the console.

Basically, just change what I currently do:

code:
clear && jslint myapp.js
to:

code:
clear && jslint myapp.js && testtool myapp.js mytests.js
or something. My use case for JavaScript in the foreseeable future is small and simple. Mostly greasemonkey scripts or small single page "apps" using no external libraries. I would just like the extra confidence unit testing can give in some circumstances.


e: Welp, probably should have googled better before posting, maybe mocha is what I want?

Both Jasmine and Mocha are probably going to be somewhat too heavyweight for what you want. They're usable, but if you want something simpler I'd suggest one of the various doctests for javascript. They're the next step up from testing by sprinkling asserts into your code.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

The Insect Court posted:

I don't know if this should go in the Clojure thread or here, but for anyone fairly familiar with it, does Clojurescript eliminate any major Javascript warts(that Coffeescript doesn't)? I've played around with it a bit, enough to get the basic syntax down, but as of yet there hasn't been any wow moments.

While you're trying out compile to JavaScript stuff, be sure to check out Typescript. It addresses a very different focus than Coffee script, in that rather than syntax it focuses on large scale problems like contract behaviour with static typing, and has a really well thought out approach to JavaScript interoperability so bringing in libraries is not a big drama.

Certainly where I'm making my switch, doesn't hurt that the syntax is basically ES6 too.

Xik
Mar 10, 2011

Dinosaur Gum

The Insect Court posted:

Both Jasmine and Mocha are probably going to be somewhat too heavyweight for what you want. They're usable, but if you want something simpler I'd suggest one of the various doctests for javascript. They're the next step up from testing by sprinkling asserts into your code.

I'm not sure if I really like the concept of putting unit test in comments within the main script. I appreciate the suggestion of an alternative solution though.

I had another look at trying to find a "proper" way to export a script intended for the browser to a commonjs/node module. As far as I can tell, there really isn't one (please correct me if I'm wrong). So I just settled and did it in a sort of gross way.

code:
*build the object that will pollute the global scope and hook up "public" properties*

if (typeof module === 'object' && typeof module.exports === 'object') {
    module.exports = itself;
}

return itself;
I think this is pretty common, but it's really pretty poo poo since you can't guarantee that the module and exports object/property won't exist in the browser. I'm not writing a library that will be used by other developers though, so it's not a huge concern. A user running a Greasemonkey script that for some reason uses a module global object which also has an exports property will probably break, but whatever.

Now I can run it in both the browser and require it within a mocha unit test file to run from the command line. So now I:

code:
clear && mocha && jslint *.js test/*.js


:krad:

isochronous
Jul 15, 2001

*Golf Clap*

Strong Sauce posted:

Trailing dots don't make any sense at all. It's also very easy to get an error when you decide to delete the last command. Prepending dots helps it naturally align and doesn't cause any problems.

Trailing dots do make a bit of sense, but not enough that I'd use them. Basically they're just an explicit attempt to keep Javascript's "hey, this line didn't execute properly, so let's back up one line, throw a semicolon on it, and try it again" behavior from NOT breaking your code. That is, if you're a sane person and using semicolons like Crockford intended, then you WANT the interpreter to poo poo itself when a semicolon is missing, not just toss one on there and merrily proceed with some potentially hosed up logic. By using trailing dots you make your code completely un-interpretable in situations where it otherwise may not be.

Xik posted:

I just settled and did it in a sort of gross way.

JavaScript code:
*build the object that will pollute the global scope and hook up "public" properties*

if (typeof module === 'object' && typeof module.exports === 'object') {
    module.exports = itself;
}

return itself;

This is actually how pretty much every "which loader are you using?" block I've ever seen detects the use of commonJS modules. While yes, it is technically possible that there will be a "module" object in the current scope with an "exports" property that's also an object, the chance of that happening and it NOT being a commonJS loader is so, so small that I wouldn't ever worry about it. In fact, most of them don't even bother checking for "module". There is a "Universal Module Definition" that's kind of been loosely agreed upon by various JavaScript organizations/foundations/eggheads, details of which can be found Here. The "returnExports" pattern is the one I see most often "in the wild," but I do primarily front-end development. Here's the version of the returnExports pattern that assumes dependencies:

JavaScript code:
// Defines a module "returnExports" that depends another module called "b".
// Note that the name of the module is implied by the file name. It is best
// if the file name and the exported global have matching names.

// If the 'b' module also uses this type of boilerplate, then
// in the browser, it will create a global .b that is used below.

// If you do not want to support the browser global path, then you
// can remove the `root` use and the passing `this` as the first arg to
// the top function.

(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['b'], factory);
    } else if (typeof exports === 'object') {
        // Node. Does not work with strict CommonJS, but
        // only CommonJS-like environments that support module.exports,
        // like Node.
        module.exports = factory(require('b'));
    } else {
        // Browser globals (root is window)
        root.returnExports = factory(root.b);
    }
}(this, function (b) {
    //use b in some fashion.

    // Just return a value to define the module export.
    // This example returns an object, but the module
    // can return a function as the exported value.
    return {};
}));

Xik
Mar 10, 2011

Dinosaur Gum

isochronous posted:

There is a "Universal Module Definition" that's kind of been loosely agreed upon by various JavaScript organizations/foundations/eggheads, details of which can be found Here.

Great post, thanks isochronous. I wish I had known about this sooner. :sun:

isochronous
Jul 15, 2001

*Golf Clap*
No problem, it's amazing what you can find on github.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


The Insect Court posted:

I don't know if this should go in the Clojure thread or here, but for anyone fairly familiar with it, does Clojurescript eliminate any major Javascript warts(that Coffeescript doesn't)? I've played around with it a bit, enough to get the basic syntax down, but as of yet there hasn't been any wow moments.

Clojure is a cool and good language, and using immutable data structures in js has some hefty potential performance wins.

The above article is one of the reasons I really, really wanted to hurl myself into clojurescript, but my experience was that the integration with the javascript ecosystem was essentially absent.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Doc Hawkins posted:

my experience was that the integration with the javascript ecosystem was essentially absent.
I'm not entirely convinced that's a problem. There are equivalents to (or bindings for) most of the major JS libraries, and if not being able to use a library that's only saving you a few dozen lines of code isn't made up for by using a better language, then it probably wouldn't be worth learning ClojureScript even if the library difference didn't exist.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


It isn't an inherent problem, the trade-off just went the other way for me. If everything you need is on clojars, there's few downsides.

Tres Burritos
Sep 3, 2009

Subjunctive posted:

I unreservedly recommend http://effectivejs.com/ -- Dave is a great writer, understands JS as deeply as any human alive, is a great teacher, and has a lot of experience teaching and working with a variety of languages. I worked on JS engines (including with Dave) for many years, and recommend this to everyone.

Fake edit: the book, I mean. I don't necessarily recommend working on JS engines.

I picked this up a bit ago and it is great. I'm not normally a "Programming Book" kind of dude but this one is definitely worth the $$.

Doc Hawkins posted:

Clojure is a cool and good language, and using immutable data structures in js has some hefty potential performance wins.

The above article is one of the reasons I really, really wanted to hurl myself into clojurescript, but my experience was that the integration with the javascript ecosystem was essentially absent.

React looks pretty cool (was talked about in that article). Anyone here have any thoughts on it / have worked with it?

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Tres Burritos posted:

I picked this up a bit ago and it is great. I'm not normally a "Programming Book" kind of dude but this one is definitely worth the $$.


React looks pretty cool (was talked about in that article). Anyone here have any thoughts on it / have worked with it?

React is awesome. Performance absolutely destroys Angular and its much easier to manage state well. You're a lot closer to how the DOM renders too so you can make even greater performance gains without massively changing the components you're using.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Maluco Marinero posted:

React is awesome. Performance absolutely destroys Angular and its much easier to manage state well. You're a lot closer to how the DOM renders too so you can make even greater performance gains without massively changing the components you're using.

This post made me watch that Peter Hunt video (well, actually the updated version here). I gotta say it seems like I will like this more than Angular. Angular is cool and all, but it looks like I will find React a lot more intuitive.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply