cujojs/curl — pull request #50 by dvdotsenko (2012-01-21 03:03:07+00:00)
Title: HTTP Post support for dependency declaration

(Could not find a way to send a direct message. Communicating through Pull request and some stub code instead)

AMD spec obviously does not allow for `require` a dependency using an HTTP Post. Well, you can do post internally, but no way to pass the post data.

I came upon realization that I if I could get my JSON-RPC requests through curl.js somehow, along (together) with text template to render it and the JS code to drive it all it would be a happy day on my street. I, obviously, can require template text and JS, but JSON-RPC requires that I post some data (and get an answer back).

This is what I have in mind:

require(
['js/pagecode', 'text!template.html', ['jsonrpc!/jsonrpchanlder.ashx', dataObjToGiveToPlugin] ]
, function(Code, Template, Data){ /* bam! */ }
)

Passing array (could be Object, does not matter much) within the dependencies array is obviously not in AMD spec, but does not break the spec adherence.

I looked at Curl.js's code and was happy (again) to find it easy to bend and add non-string as supported dependency arg. The pull request is the very minor alteration I put in to make non-strings (arrays) args work without seemingly breaking the standard functionality.

I don't actually expect you to pull, I am rather perfectly happy keeping this change in my tree only. However, wanted to pitch something like this to you for future consideration.