Skip to content

Commit e167da8

Browse files
Merge pull request #258 from mean-expert-official/development
Release 2.1.0-rc.5
2 parents 35992e8 + d096eed commit e167da8

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
This file is created to keep history of the LoopBack SDK Builder, it does not consider or keeps any history of its parent module `loopback-sdk-angular`.
44

5+
## Release 2.1.0-rc.5
6+
7+
- Milestone Details: https://github.com/mean-expert-official/loopback-sdk-builder/milestone/27?closed=1
8+
9+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/257
10+
511
## Release 2.1.0-rc.4
612

713
- Milestone Details: https://github.com/mean-expert-official/loopback-sdk-builder/milestone/26?closed=1

lib/angular2/shared/models/flref.ejs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ export class FireLoopRef<T> {
160160
let nowEvent: any = `${event}.pull.requested.${ this.id }`;
161161
this.socket.emit(`${event}.pull.request.${ this.id }`, request);
162162
function pullNow(data: any) {
163-
that.socket.removeListener(nowEvent, pullNow);
163+
if (that.socket.removeListener) {
164+
that.socket.removeListener(nowEvent, pullNow);
165+
}
164166
sbj.next(data);
165167
};
166168
this.socket.on(nowEvent, pullNow);

lib/angular2/shared/services/core/realtime.ejs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,47 @@ import { LoopBackConfig } from '../../lb.config';
66
import { FireLoop } from '../../models/FireLoop';
77
import { SocketConnections } from '../../sockets/socket.connections';
88
import { SDKModels } from '../custom/SDKModels';
9+
import { Observable } from 'rxjs/Observable';
10+
import { Subject } from 'rxjs/Subject';
911

1012
@Injectable()
1113
export class RealTime {
1214

1315
public IO: IO;
1416
public FireLoop: FireLoop;
17+
private connected: boolean = false;
18+
private socket: any;
1519

1620
constructor(
1721
@Inject(SocketConnections) protected connections: SocketConnections,
1822
@Inject(SDKModels) protected models: SDKModels,
1923
@Inject(LoopBackAuth) protected auth: LoopBackAuth,
2024
@Inject(JSONSearchParams) protected searchParams: JSONSearchParams
2125
) {
22-
let socket: any = this.getConnection();
23-
this.IO = new IO(socket);
24-
this.FireLoop = new FireLoop(socket, models);
26+
this.socket = this.getConnection();
27+
this.IO = new IO(this.socket);
28+
this.FireLoop = new FireLoop(this.socket, models);
2529
}
2630

2731
getConnection(): void {
2832
return this.connections.getHandler(LoopBackConfig.getPath(), this.auth.getToken());
2933
}
34+
/**
35+
* @method onReady
36+
* @description
37+
* Will trigger when FireLoop is Ready for broadcasting.
38+
**/
39+
public onReady(): Observable<null> {
40+
let subject: Subject<null> = new Subject<null>();
41+
if (this.connected) {
42+
subject.next();
43+
} else {
44+
this.socket.on('connect', () => {
45+
this.connected = true;
46+
subject.next();
47+
});
48+
this.socket.on('disconnect', () => this.connected = false);
49+
}
50+
return subject.asObservable();
51+
}
3052
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mean-expert/loopback-sdk-builder",
3-
"version": "2.1.0-rc.4",
3+
"version": "2.1.0-rc.5",
44
"description": "Tool for auto-generating Software Development Kits (SDKs) for LoopBack",
55
"bin": {
66
"lb-sdk": "bin/lb-sdk"

0 commit comments

Comments
 (0)