From d81a8837f8fab7cd854fe29ccd26b41f1fca1d5f Mon Sep 17 00:00:00 2001 From: Adrien Castex Date: Thu, 29 Jun 2017 19:03:51 +0200 Subject: [PATCH] Made the callback optional in the 'addSubTree' of the 'FileSystem' class --- lib/manager/v2/fileSystem/FileSystem.js | 3 ++- src/manager/v2/fileSystem/FileSystem.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/manager/v2/fileSystem/FileSystem.js b/lib/manager/v2/fileSystem/FileSystem.js index 86113c6c..bf384aca 100644 --- a/lib/manager/v2/fileSystem/FileSystem.js +++ b/lib/manager/v2/fileSystem/FileSystem.js @@ -643,9 +643,10 @@ var FileSystem = (function () { }; FileSystem.prototype.addSubTree = function (ctx, _rootPath, _tree, _callback) { var _this = this; - var callback = _callback ? _callback : _tree; var tree = _callback ? _tree : _rootPath; var rootPath = _callback ? new Path_1.Path(_rootPath) : new Path_1.Path('/'); + var callback = _callback ? _callback : _tree; + callback = callback ? callback : function () { }; if (tree.constructor === CommonTypes_1.ResourceType) { this.create(ctx, rootPath, tree, callback); } diff --git a/src/manager/v2/fileSystem/FileSystem.ts b/src/manager/v2/fileSystem/FileSystem.ts index 4c26c418..18083905 100644 --- a/src/manager/v2/fileSystem/FileSystem.ts +++ b/src/manager/v2/fileSystem/FileSystem.ts @@ -843,9 +843,10 @@ export abstract class FileSystem implements ISerializableFileSystem addSubTree(ctx : RequestContext, rootPath : Path | string, resourceType : ResourceType, callback : SimpleCallback) addSubTree(ctx : RequestContext, _rootPath : Path | string | SubTree | ResourceType | SimpleCallback, _tree : SubTree | ResourceType | SimpleCallback, _callback ?: SimpleCallback) { - const callback = _callback ? _callback : _tree as SimpleCallback; const tree = _callback ? _tree as SubTree | ResourceType : _rootPath as SubTree | ResourceType; const rootPath = _callback ? new Path(_rootPath as Path | string) : new Path('/'); + let callback = _callback ? _callback : _tree as SimpleCallback; + callback = callback ? callback : () => {}; if(tree.constructor === ResourceType) {