aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/LoaderRef.js
blob: 3ce0970d0bd729a9319da392c7af36789553d183 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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;