Merge remote-tracking branch 'origin/master'

This commit is contained in:
Danny Yoo 2011-08-14 18:58:53 -04:00
commit 8fb2dd6ad8

20
resource/js-impl.js Normal file
View File

@ -0,0 +1,20 @@
var resourceType = MACHINE.modules['whalesong/resource/structs.rkt'].getNamespace()['struct:resource'];
var makePrimitiveProcedure = plt.baselib.functions.makePrimitiveProcedure;
var checkResource = plt.baselib.check.makeCheckArgumentType(
resourceType.predicate,
"resource");
var getResourcePath = function(r) { return resourceType.accessor(r, 0); };
var getResourceKey = function(r) { return resourceType.accessor(r, 1); };
EXPORTS['resource->url'] = makePrimitiveProcedure(
'resource->url',
1,
function(MACHINE) {
var resource = checkResource(MACHINE, 'resource->url', 0);
return "res/" + String(getResourceKey(resource));
});