Skip to content

Commit

Permalink
[CHORE] Extract FactoryStamp to it's own class
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaskiewicz committed Sep 23, 2017
1 parent 880a3f2 commit 16c037d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Output Files
coverage/
node_modules/
dist/
*.tgz

# NPM Files
node_modules/
npm-debug.log

# IDE
.vscode
10 changes: 3 additions & 7 deletions src/factoryMate/FactoryMate.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { FactoryStamp } from './FactoryStamp';

export class FactoryMate {
public static definedConstructors: any[] = [];

Expand All @@ -6,13 +8,7 @@ export class FactoryMate {
}

public static defineWithName(cns: any, alias: string, initFunction: () => void) {
FactoryMate.definedConstructors.push(
{
classAlias: alias,
classConstructor: cns,
initializationFunction: initFunction
}
);
FactoryMate.definedConstructors.push(new FactoryStamp(cns, alias, initFunction));
}

public static build(itemName: string, overrideFn?: (clazz: any) => any) {
Expand Down
11 changes: 11 additions & 0 deletions src/factoryMate/FactoryStamp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export class FactoryStamp {
public classAlias: string;
public classConstructor: any;
public initializationFunction: () => void;

constructor(cns: any, alias: string, initFunction: () => void) {
this.classConstructor = cns;
this.classAlias = alias;
this.initializationFunction = initFunction;
}
}

0 comments on commit 16c037d

Please sign in to comment.