Skip to content

Commit

Permalink
improve the code of proxy and added nodemon
Browse files Browse the repository at this point in the history
  • Loading branch information
kanekotic committed Nov 30, 2019
1 parent 960a738 commit 4299065
Show file tree
Hide file tree
Showing 5 changed files with 475 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/actor-system/actor-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ export default class ActorProxy {
public static of<T extends IActor>(mailbox: Mailbox<ActorMessage>, actor: T): T {
let allNames: string[] = []
for (let o = actor; o && (o as any) !== Actor.prototype; o = Object.getPrototypeOf(o)) {
allNames = allNames.concat(Object.getOwnPropertyNames(o).filter(a => typeof (o as any)[a] === 'function'))
allNames = allNames.concat(Object.getOwnPropertyNames(o).filter(a => typeof (o as any)[a] === 'function' && a !== 'constructor'))
}

return allNames
.filter(name => name !== 'constructor')
.map(
(name: string): [string, any] => [
name,
Expand Down
2 changes: 0 additions & 2 deletions lib/actor-system/actor-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ export default class ActorSystem implements IProcessor {

const proxy = ActorProxy.of(this.mailbox, instance)
this.setupInstance(instance, proxy)
console.log("here1")
return proxy
}
console.log("here2")
return ActorProxy.of(this.mailbox, instance as T)
}

Expand Down
5 changes: 5 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"watch": ["lib"],
"ext": "ts",
"exec": "yarn build"
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"scripts": {
"prepare": "yarn build && yarn build:cdn",
"build": "tsc",
"build:dev": "nodemon",
"build:cdn": "yarn build && rollup -c",
"build:doc": "jsdoc2md --files 'lib/**/*.ts' --configure jsdoc2md.json > API.md",
"format": "prettier --write \"**/*.ts\" && tslint -p tsconfig.json --fix lib/**/*.ts -t verbose",
Expand Down Expand Up @@ -57,6 +58,7 @@
"faker": "4.1.0",
"jest": "24.3.1",
"jsdoc-babel": "0.5.0",
"nodemon": "^2.0.1",
"prettier": "1.16.4",
"rollup": "1.6.0",
"rollup-plugin-commonjs": "9.2.1",
Expand Down

0 comments on commit 4299065

Please sign in to comment.