Skip to content

Commit

Permalink
Made fsManager argument optional in constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed May 12, 2017
1 parent 0369cbd commit aa02333
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/resource/VirtualResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ResourceChildren } from './ResourceChildren';
import { FSManager, FSPath } from '../manager/FSManager';
export declare abstract class VirtualResource extends StandardResource {
name: string;
constructor(name: string, parent: IResource, fsManager: FSManager);
constructor(name: string, parent: IResource, fsManager?: FSManager);
create(callback: SimpleCallback): void;
delete(callback: SimpleCallback): void;
moveTo(to: FSPath, callback: Return2Callback<FSPath, FSPath>): void;
Expand All @@ -21,7 +21,7 @@ export declare abstract class VirtualResource extends StandardResource {
}
export declare class VirtualFolder extends VirtualResource {
children: ResourceChildren;
constructor(name: string, parent: IResource, fsManager: FSManager);
constructor(name: string, parent: IResource, fsManager?: FSManager);
type(callback: ReturnCallback<ResourceType>): void;
append(data: Int8Array, callback: SimpleCallback): void;
write(data: Int8Array, callback: SimpleCallback): void;
Expand All @@ -34,7 +34,7 @@ export declare class VirtualFolder extends VirtualResource {
}
export declare class VirtualFile extends VirtualResource {
content: Int8Array;
constructor(name: string, parent: IResource, fsManager: FSManager);
constructor(name: string, parent: IResource, fsManager?: FSManager);
type(callback: ReturnCallback<ResourceType>): void;
create(callback: SimpleCallback): void;
delete(callback: SimpleCallback): void;
Expand Down
3 changes: 2 additions & 1 deletion lib/resource/VirtualResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ var __extends = (this && this.__extends) || (function () {
Object.defineProperty(exports, "__esModule", { value: true });
var Resource_1 = require("./Resource");
var ResourceChildren_1 = require("./ResourceChildren");
var VirtualFSManager_1 = require("../manager/VirtualFSManager");
var mimeTypes = require("mime-types");
var VirtualResource = (function (_super) {
__extends(VirtualResource, _super);
function VirtualResource(name, parent, fsManager) {
var _this = _super.call(this, parent, fsManager) || this;
var _this = _super.call(this, parent, fsManager ? fsManager : new VirtualFSManager_1.VirtualFSManager()) || this;
_this.name = name;
return _this;
}
Expand Down
9 changes: 5 additions & 4 deletions src/resource/VirtualResource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { StandardResource, IResource, SimpleCallback, ReturnCallback, Return2Callback, ResourceType } from './Resource'
import { ResourceChildren, forAll } from './ResourceChildren'
import { FSManager, FSPath } from '../manager/FSManager'
import { VirtualFSManager } from '../manager/VirtualFSManager'
import * as mimeTypes from 'mime-types'
import * as path from 'path'
import * as fs from 'fs'
Expand All @@ -9,9 +10,9 @@ export abstract class VirtualResource extends StandardResource
{
name : string

constructor(name : string, parent : IResource, fsManager : FSManager)
constructor(name : string, parent : IResource, fsManager ?: FSManager)
{
super(parent, fsManager);
super(parent, fsManager ? fsManager : new VirtualFSManager());

this.name = name;
}
Expand Down Expand Up @@ -60,7 +61,7 @@ export class VirtualFolder extends VirtualResource
{
children : ResourceChildren

constructor(name : string, parent : IResource, fsManager : FSManager)
constructor(name : string, parent : IResource, fsManager ?: FSManager)
{
super(name, parent, fsManager);

Expand Down Expand Up @@ -114,7 +115,7 @@ export class VirtualFile extends VirtualResource
{
content : Int8Array

constructor(name : string, parent : IResource, fsManager : FSManager)
constructor(name : string, parent : IResource, fsManager ?: FSManager)
{
super(name, parent, fsManager);

Expand Down

0 comments on commit aa02333

Please sign in to comment.