From 03b840cb5fb8ff5217fefc9e1240a3131db309fc Mon Sep 17 00:00:00 2001 From: eric thul Date: Tue, 11 Aug 2015 20:57:07 -0400 Subject: PureScript 0.7 updates and migration to pulp --- src/PursLoader/LoaderRef.js | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/PursLoader/LoaderRef.js (limited to 'src/PursLoader/LoaderRef.js') diff --git a/src/PursLoader/LoaderRef.js b/src/PursLoader/LoaderRef.js new file mode 100644 index 0000000..3ce0970 --- /dev/null +++ b/src/PursLoader/LoaderRef.js @@ -0,0 +1,56 @@ +'use strict'; + +// module PursLoader.LoaderRef + +function asyncFn(isJust, fromMaybe, ref){ + return function(){ + var callback = ref.async(); + return function(error){ + return function(value){ + return function(){ + return isJust(error) ? callback(fromMaybe(new Error())(error)) + : callback(null, value); + }; + }; + }; + }; +} +function cacheable(ref){ + return function(){ + return ref.cacheable && ref.cacheable(); + }; +} + +function query(ref){ + return ref.query; +} + +function clearDependencies(ref){ + return function(){ + return ref.clearDependencies(); + }; +} + +function resourcePath(ref){ + return ref.resourcePath; +} + +function addDependency(ref){ + return function(dep){ + return function(){ + return ref.addDependency(dep); + }; + }; +} + +exports.asyncFn = asyncFn; + +exports.cacheable = cacheable; + +exports.query = query; + +exports.clearDependencies = clearDependencies; + +exports.resourcePath = resourcePath; + +exports.addDependency = addDependency; -- cgit v1.2.3