Skip to content

Commit

Permalink
Merge pull request #8 from zlq4863947/zlq-mod
Browse files Browse the repository at this point in the history
单主题连接bug修正
  • Loading branch information
zlq4863947 committed Oct 7, 2017
2 parents 4f6bea2 + 35b4432 commit fbe9914
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/src
/log
/logs
/node_modules
/dist/**/*.test.js
/dist/**/*.test.d.ts
Expand Down
6 changes: 3 additions & 3 deletions dll/client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public async Task<object> GetInvoker(IDictionary<string, object> input)
? (Func<object, Task<object>>)opts["callback"] : (o) => null;
var results = new List<IDictionary<string, object>>();
/*
string item = null;
if (opts.ContainsKey("item"))
{
Expand Down Expand Up @@ -149,9 +149,9 @@ public async Task<object> GetInvoker(IDictionary<string, object> input)
case "IsPaused":
return client.IsPaused;
}
}
} */
if (clients.Count >= 1)
if (clients.Count != 0)
{
switch (method)
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-dde",
"version": "0.1.6",
"version": "0.1.8",
"description": "Dynamic Data Exchange (DDE) 通信组件",
"repository": {
"type": "git",
Expand Down
3 changes: 1 addition & 2 deletions src/lib/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ describe('DDE客户端测试', () => {

it('测试多个主题的客户端通信', function (done) {
this.timeout(20000);
// testMultipleTopic(done);
done();
done(); // testMultipleTopic(done);
});

});
21 changes: 2 additions & 19 deletions src/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ export class Client extends EventEmitter {
}
}
}
const topicKeys = Object.keys(input[Object.keys(input)[0]]);
if (topicKeys.length === 1) {
// 只有一个主题时,赋值
this.item = topicKeys[0];
}
this._invoke = getInvoker(opts, true);
}

Expand Down Expand Up @@ -73,9 +68,6 @@ export class Client extends EventEmitter {
};

poke = (item: string | null, data: string, timeout: number) => {
if (item) {
this.item = item;
}
this._invoke({
method: 'Poke',
item: this.item || '',
Expand All @@ -85,9 +77,6 @@ export class Client extends EventEmitter {
};

request = (item: string | null, format: string, timeout: number) => {
if (item) {
this.item = item;
}
return this._invoke({
method: 'Request',
item: this.item || '',
Expand All @@ -96,10 +85,7 @@ export class Client extends EventEmitter {
}, true);
};

startAdvise = (item?: string, format?: string, hot?: boolean, timeout?: number) => {
if (item) {
this.item = item;
}
startAdvise = (item?: string[], format?: string, hot?: boolean, timeout?: number) => {
this._invoke({
method: 'StartAdvise',
item: this.item || '',
Expand All @@ -109,10 +95,7 @@ export class Client extends EventEmitter {
}, true);
};

stopAdvise = (item?: string, timeout?: number) => {
if (item) {
this.item = item;
}
stopAdvise = (item?: string[], timeout?: number) => {
this._invoke({
method: 'StopAdvise',
item: this.item || '',
Expand Down

0 comments on commit fbe9914

Please sign in to comment.