Friday, August 22, 2014

L00k, I haz JavaScriptz!!! ô-ô

I recently published several JavaScript libraries. Some not so recently:)

#1. Freemason

https://www.npmjs.org/package/freemason
https://github.com/spikesagal/freemason

A build utility that is super-simple to use and doesn't require any configuration. Here's an example:
var build = require('freemason').tasks;
build.concatenate('LAB.src.js','jsrequire.src.js');
build.minify();
build.attribute('src/credits.txt');
build.write('dist/jsrequire.min.js');

#2. Require

https://github.com/spikesagal/require

Client-side asynchronous script importing, built on top of LABjs. Here is an example:
var YourModule = require('/path/to/your_module.js', function() {
  YourModule.executeFunction();
});

#3. Wedge

https://github.com/spikesagal/wedge

A browser compatibility shim. Currently supports IE 8+.

#4. TemperSynth


A musical synthesizer with dynamically controlled scale temperament. This was my music hackathon project @ Spotify.

Sunday, December 01, 2013

Client-side JavaScript Module Loading

Thank you Tom Dale for pointing out why RequireJS completely misses the point of requiring modules. While I agree with that assessment, there are better ways to store (unparsed) functions than as strings.

I am still hoping to find a library that takes a healthy approach to implementing require functionality for client-side JavaScript. If I don't find anything soon though, I will have to make one myself. Here are the key aspects I will require of... require:

  • Modules should be stored unparsed until required.
  • A require command will be null code if the module had already loaded.
  • A require command will parse the module and append it as a property of the current scope if it had not yet been loaded but is available to the client.
  • A require command will attempt to retrieve the module file via AJAX if it is not available to the client.
  • A require command will throw an error if the module is unavailable on both the client and the server.
  • The same require command will be parsed by the packager on the server side to compile the module into the distribution file.

Now back to my quest...