anviljs/anvil.js — pull request #61 by ifandelse (2013-02-08 05:22:39+00:00)
Title: Modified Script Injection

The current script injection includes socket.io as an anonymous module if the hosted page has require.js (or another AMD loader) present, resulting in the following error:

`Uncaught Error: Mismatched anonymous define() module: function () { return io; }`

This means that any anvil-hosted assets using AMD will fail. I've modified what gets injected so that it's a single script tag that tests for amd. If amd is detected, it will set up a named path for socket.io via require.config() and then require the socket.io client lib. Once the lib is present, the anvil buildHook.js file is included. If amd is not detected, both socket.io and the buildHook.js file are pulled the old fashioned way (via adding script tags to the body).