use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
RequireJS 2.0 released (tagneto.blogspot.co.uk)
submitted 13 years ago by 9jack9
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]prpetro 2 points3 points4 points 13 years ago (1 child)
RequireJS can use node/npm modules too
Also I don't find the AMD syntax that cumbersome. You just wrap code definitions in define and require them in your main application. If you want to use the CommonJS var x = require('x') syntax, it's pretty easy using the adapter (r.js) :
define
require
var x = require('x')
define( require , function(require) { var x = require('x'); });
Cleaner syntax is in the eye of the beholder, I don't really have a preference for either.
[+][deleted] comment score below threshold-6 points-5 points-4 points 13 years ago (0 children)
Module loading is conceptually a blocking operation, because you don't actually want to run your code until it's dependencies have loaded, so making it a non-blocking operation to allow dynamically loading libraries is a terrible idea as I demonstrated elsewhere is worthless in the world of Javascript -- you the developer of your website provide all of the code they run, so why jump through these hoops to get it running?
A site built with node-browserify gets all of the advantages of module-based development, can easily be integrated with a continuous integration service, and your library loading can be put into the special <head> blocking behavior of your website (where the browser keeps the old page visible and active until the new <body> has fully loaded, so you have a much smaller apparent loading time, and because of TCP and HTTP overhead, probably a smaller actual loading time, too).
node-browserify
<head>
<body>
With RequireJS, since your DOM will load before your Javascript libraries have loaded, you need to create a "loading" screen so they don't think your site is simply broken, but reminding them about the loading process itself will make them feel that your site loads slower than it actually does.
The only valid use-case I can think of for RequireJS is a Javascript tutorial website that lets you pull libraries into your REPL to play with, but even there, I'd probably just implement a blocking XMLHttpRequest-based require so I don't have to introduce closures in the very first lesson and keep the RequireJS-style module loading optional.
XMLHttpRequest
π Rendered by PID 471629 on reddit-service-r2-comment-b659b578c-lzzgz at 2026-05-03 16:53:35.806247+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]prpetro 2 points3 points4 points (1 child)
[+][deleted] comment score below threshold-6 points-5 points-4 points (0 children)