MCPcopy
hub / github.com/CodeboxIDE/codebox / fsCall

Function fsCall

client/core/localfs.js:29–51  ·  view source on GitHub ↗
(method, args, context)

Source from the content-addressed store, hash-verified

27 var filer = new Filer();
28
29 var fsCall = function(method, args, context) {
30 if (!_syncIsEnable) return Q.reject(new Error("Offline synchronization is disabled"));
31 if (_.isUndefined(args)) args = [];
32 if (!_.isArray(args)) args = [args];
33
34 var d = Q.defer();
35 args.push(function() {
36 if (arguments.length == 1) return d.resolve(arguments[0]);
37 d.resolve(arguments);
38 });
39 args.push(function(err) {
40 logger.error("Error occurs: ", method.name, err);
41 d.reject(err);
42 })
43
44 try {
45 method.apply(context, args);
46 } catch(err) {
47 d.reject(err);
48 }
49
50 return d.promise;
51 };
52
53 /*
54 * Init the localfs

Callers 2

prepareFsFunction · 0.85
localfs.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected