This commit is contained in:
syuilo 2018-03-07 17:48:32 +09:00
parent 6c495268ae
commit 161fd4afab
37 changed files with 747 additions and 219 deletions

View file

@ -1,20 +0,0 @@
import StreamManager from './stream-manager';
import Connection from './drive-stream';
export default class DriveStreamManager extends StreamManager<Connection> {
private me;
constructor(me) {
super();
this.me = me;
}
public getConnection() {
if (this.connection == null) {
this.connection = new Connection(this.me);
}
return this.connection;
}
}

View file

@ -1,12 +0,0 @@
import Stream from './stream';
/**
* Drive stream connection
*/
export default class Connection extends Stream {
constructor(me) {
super('drive', {
i: me.token
});
}
}

View file

@ -0,0 +1,31 @@
import Stream from './stream';
import StreamManager from './stream-manager';
/**
* Drive stream connection
*/
export class DriveStream extends Stream {
constructor(me) {
super('drive', {
i: me.token
});
}
}
export class DriveStreamManager extends StreamManager<DriveStream> {
private me;
constructor(me) {
super();
this.me = me;
}
public getConnection() {
if (this.connection == null) {
this.connection = new DriveStream(this.me);
}
return this.connection;
}
}

View file

@ -1,23 +0,0 @@
import StreamManager from './stream-manager';
import Connection from './home-stream';
import MiOS from '../../mios';
export default class HomeStreamManager extends StreamManager<Connection> {
private me;
private os: MiOS;
constructor(os: MiOS, me) {
super();
this.me = me;
this.os = os;
}
public getConnection() {
if (this.connection == null) {
this.connection = new Connection(this.os, this.me);
}
return this.connection;
}
}

View file

@ -1,12 +1,13 @@
import * as merge from 'object-assign-deep';
import Stream from './stream';
import StreamManager from './stream-manager';
import MiOS from '../../mios';
/**
* Home stream connection
*/
export default class Connection extends Stream {
export class HomeStream extends Stream {
constructor(os: MiOS, me) {
super('', {
i: me.token
@ -34,3 +35,23 @@ export default class Connection extends Stream {
});
}
}
export class HomeStreamManager extends StreamManager<HomeStream> {
private me;
private os: MiOS;
constructor(os: MiOS, me) {
super();
this.me = me;
this.os = os;
}
public getConnection() {
if (this.connection == null) {
this.connection = new HomeStream(this.os, this.me);
}
return this.connection;
}
}

View file

@ -1,20 +0,0 @@
import StreamManager from './stream-manager';
import Connection from './messaging-index-stream';
export default class MessagingIndexStreamManager extends StreamManager<Connection> {
private me;
constructor(me) {
super();
this.me = me;
}
public getConnection() {
if (this.connection == null) {
this.connection = new Connection(this.me);
}
return this.connection;
}
}

View file

@ -1,12 +0,0 @@
import Stream from './stream';
/**
* Messaging index stream connection
*/
export default class Connection extends Stream {
constructor(me) {
super('messaging-index', {
i: me.token
});
}
}

View file

@ -0,0 +1,31 @@
import Stream from './stream';
import StreamManager from './stream-manager';
/**
* Messaging index stream connection
*/
export class MessagingIndexStream extends Stream {
constructor(me) {
super('messaging-index', {
i: me.token
});
}
}
export class MessagingIndexStreamManager extends StreamManager<MessagingIndexStream> {
private me;
constructor(me) {
super();
this.me = me;
}
public getConnection() {
if (this.connection == null) {
this.connection = new MessagingIndexStream(this.me);
}
return this.connection;
}
}

View file

@ -3,7 +3,7 @@ import Stream from './stream';
/**
* Messaging stream connection
*/
export default class Connection extends Stream {
export class MessagingStream extends Stream {
constructor(me, otherparty) {
super('messaging', {
i: me.token,

View file

@ -0,0 +1,10 @@
import Stream from './stream';
export class OthelloGameStream extends Stream {
constructor(me, game) {
super('othello-game', {
i: me.token,
game: game.id
});
}
}

View file

@ -0,0 +1,28 @@
import StreamManager from './stream-manager';
import Stream from './stream';
export class OthelloStream extends Stream {
constructor(me) {
super('othello', {
i: me.token
});
}
}
export class OthelloStreamManager extends StreamManager<OthelloStream> {
private me;
constructor(me) {
super();
this.me = me;
}
public getConnection() {
if (this.connection == null) {
this.connection = new OthelloStream(this.me);
}
return this.connection;
}
}

View file

@ -1,12 +0,0 @@
import StreamManager from './stream-manager';
import Connection from './requests-stream';
export default class RequestsStreamManager extends StreamManager<Connection> {
public getConnection() {
if (this.connection == null) {
this.connection = new Connection();
}
return this.connection;
}
}

View file

@ -1,10 +0,0 @@
import Stream from './stream';
/**
* Requests stream connection
*/
export default class Connection extends Stream {
constructor() {
super('requests');
}
}

View file

@ -0,0 +1,21 @@
import Stream from './stream';
import StreamManager from './stream-manager';
/**
* Requests stream connection
*/
export class RequestsStream extends Stream {
constructor() {
super('requests');
}
}
export class RequestsStreamManager extends StreamManager<RequestsStream> {
public getConnection() {
if (this.connection == null) {
this.connection = new RequestsStream();
}
return this.connection;
}
}

View file

@ -1,12 +0,0 @@
import StreamManager from './stream-manager';
import Connection from './server-stream';
export default class ServerStreamManager extends StreamManager<Connection> {
public getConnection() {
if (this.connection == null) {
this.connection = new Connection();
}
return this.connection;
}
}

View file

@ -1,10 +0,0 @@
import Stream from './stream';
/**
* Server stream connection
*/
export default class Connection extends Stream {
constructor() {
super('server');
}
}

View file

@ -0,0 +1,21 @@
import Stream from './stream';
import StreamManager from './stream-manager';
/**
* Server stream connection
*/
export class ServerStream extends Stream {
constructor() {
super('server');
}
}
export class ServerStreamManager extends StreamManager<ServerStream> {
public getConnection() {
if (this.connection == null) {
this.connection = new ServerStream();
}
return this.connection;
}
}