You can't just say "remove local state and use HTTP instead" - people didn't invent local state from nowhere, it has a lot of advantages to relying on an HTTP call for everything you do. Particularly when you're scaling out widely or when you're dealing with mobile devices.
You do appear to be overly keen on pimping it, but it looks kinda unnecessary.
Anyhow, move that "use strict;" line into the IIFE. If it's global, you can't merge that file with other files. Some of the code out there breaks in strict mode. That's why it isn't enabled by default.
On "use strict", my understanding was that it applies per script:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Strict mode applies to entire scripts or to individual functions.
Am I misunderstanding?
Since the rest of your script is already enclosed inside a single function, simply move the "use strict" a few lines down so it is the first line in that function. Then it will only apply to your own code.
If it has an entry point, it's not a library, it's an application. If said application does basically nothing on its own and you're supposed to extend it, it's a framework.
http://en.wikipedia.org/wiki/Software_framework
Pay close attention to the 4 bullet points in the first section.
> On "use strict", my understanding was that it applies per script
Yes. However, when you merge scripts, there is only one script at the end.
The site you linked to also mentions this problem.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
"This syntax has a trap that has already bitten a major site: it isn't possible to blindly concatenate non-conflicting scripts. [...] It is thus recommended that you enable strict mode on a function-by-function basis [...]"
Good point on the concatenation issue, I'll fix it for the next release.
It does.
There is an IIFE which is run when the script is loaded. Right before the object is returned to the global "Intercooler" variable, a callback is registered via a jQuery.ready() shorthand.
Practically speaking, this callback is the entry point (theoretically, it's the IIFE itself).
If it wouldn't have an entry point, adding attributes to elements would do nothing.
http://en.wikipedia.org/wiki/Entry_point
"an entry point is where control enters a program or piece of code"
I looked at various data-binding javascript libraries, but they all seem like targeting much bigger problems than mine. So I resort to classic jquery, data attributes and ajax calls, but it feels very messy, like a hack not intended to work that way. It may be the fact that I'm new to this but it feels as if I'm missing something very obvious whenever I have to deal with that kind of very basic interactivity and dynamic. It's a simple form that temporarily needs to calculate and process inputs until the user saves the record and solving this seems way too complicated and messy. Are there any options for those simple cases and apps that otherwise would do just fine with a document-based architecture?
jQuery is fine for this too, but can become painful to use and organize once you have a lot of DOM manipulations.
React only starts to get complicated once you dive into the Routing + Data Fetching + Flux stuff IMO. React on it's own if you don't need any of that is pretty simple.
It hits the sweet spot between easy learning curve, abstraction, and interacting with the DOM nicely.
Sadly, it's not as hip as React/Angular/Ember these days.
Microsoft uses it their recent remake of their Azure portal; this page has a video on building large apps with Knockout: http://jbeckwith.com/2014/09/20/how-the-azure-portal-works/
So basically go back to writing Javascript like we were doing ten years ago?
No thanks.
I was there, it was hell, I hated every second of it.
The Javascript framework scene is very chaotic today but it's exciting, a lot of new concepts and approaches are being discovered on a weekly basis. A lot of them won't pan out but some will, and they will make writing Javascript even more fun than it is today.
And one thing I know for sure: it's hell of a lot more fun to write Javascript today than it was ten years ago.
Get rid of all the abstraction, local state, dependency injection, symbol management and so on. Take HTML/HTTP seriously and think about REST in terms of HTML rather than JSON.
That's intercooler.js:
http://intercoolerjs.org
Here's an image I tweeted trying to explain how to get there mentally:
https://pbs.twimg.com/media/B9QNU-ZCQAECP-K.png:large
Yes, it's a simple model. And no, it doesn't work for every app. But many apps would be infinitely simpler and more usable in a browser by using this approach, and almost all apps have some part of them that would be simpler to implement using it.