Skip to content

Commit

Permalink
Merge pull request #258 from mean-expert-official/development
Browse files Browse the repository at this point in the history
Release 2.1.0-rc.5
  • Loading branch information
jonathan-casarrubias authored Dec 15, 2016
2 parents 35992e8 + d096eed commit e167da8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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`.

## Release 2.1.0-rc.5

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

- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/257

## Release 2.1.0-rc.4

- Milestone Details: https://github.com/mean-expert-official/loopback-sdk-builder/milestone/26?closed=1
Expand Down
4 changes: 3 additions & 1 deletion lib/angular2/shared/models/flref.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ export class FireLoopRef<T> {
let nowEvent: any = `${event}.pull.requested.${ this.id }`;
this.socket.emit(`${event}.pull.request.${ this.id }`, request);
function pullNow(data: any) {
that.socket.removeListener(nowEvent, pullNow);
if (that.socket.removeListener) {
that.socket.removeListener(nowEvent, pullNow);
}
sbj.next(data);
};
this.socket.on(nowEvent, pullNow);
Expand Down
28 changes: 25 additions & 3 deletions lib/angular2/shared/services/core/realtime.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,47 @@ import { LoopBackConfig } from '../../lb.config';
import { FireLoop } from '../../models/FireLoop';
import { SocketConnections } from '../../sockets/socket.connections';
import { SDKModels } from '../custom/SDKModels';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';

@Injectable()
export class RealTime {

public IO: IO;
public FireLoop: FireLoop;
private connected: boolean = false;
private socket: any;

constructor(
@Inject(SocketConnections) protected connections: SocketConnections,
@Inject(SDKModels) protected models: SDKModels,
@Inject(LoopBackAuth) protected auth: LoopBackAuth,
@Inject(JSONSearchParams) protected searchParams: JSONSearchParams
) {
let socket: any = this.getConnection();
this.IO = new IO(socket);
this.FireLoop = new FireLoop(socket, models);
this.socket = this.getConnection();
this.IO = new IO(this.socket);
this.FireLoop = new FireLoop(this.socket, models);
}

getConnection(): void {
return this.connections.getHandler(LoopBackConfig.getPath(), this.auth.getToken());
}
/**
* @method onReady
* @description
* Will trigger when FireLoop is Ready for broadcasting.
**/
public onReady(): Observable<null> {
let subject: Subject<null> = new Subject<null>();
if (this.connected) {
subject.next();
} else {
this.socket.on('connect', () => {
this.connected = true;
subject.next();
});
this.socket.on('disconnect', () => this.connected = false);
}
return subject.asObservable();
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mean-expert/loopback-sdk-builder",
"version": "2.1.0-rc.4",
"version": "2.1.0-rc.5",
"description": "Tool for auto-generating Software Development Kits (SDKs) for LoopBack",
"bin": {
"lb-sdk": "bin/lb-sdk"
Expand Down

0 comments on commit e167da8

Please sign in to comment.