2017-11-15 20:06:52 +02:00
|
|
|
import * as riot from 'riot';
|
|
|
|
|
|
|
|
import MiOS from './mios';
|
|
|
|
import ServerStreamManager from './scripts/server-stream-manager';
|
|
|
|
import RequestsStreamManager from './scripts/requests-stream-manager';
|
2017-11-16 16:46:54 +02:00
|
|
|
import MessagingIndexStreamManager from './scripts/messaging-index-stream-manager';
|
2017-11-16 16:46:36 +02:00
|
|
|
import DriveStreamManager from './scripts/drive-stream-manager';
|
2017-11-15 20:06:52 +02:00
|
|
|
|
|
|
|
export default (mios: MiOS) => {
|
|
|
|
(riot as any).mixin('os', {
|
|
|
|
mios: mios
|
|
|
|
});
|
|
|
|
|
|
|
|
(riot as any).mixin('i', {
|
|
|
|
init: function() {
|
|
|
|
this.I = mios.i;
|
|
|
|
this.SIGNIN = mios.isSignedin;
|
|
|
|
|
|
|
|
if (this.SIGNIN) {
|
|
|
|
this.on('mount', () => {
|
|
|
|
mios.i.on('updated', this.update);
|
|
|
|
});
|
|
|
|
this.on('unmount', () => {
|
|
|
|
mios.i.off('updated', this.update);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
me: mios.i
|
|
|
|
});
|
|
|
|
|
|
|
|
(riot as any).mixin('api', {
|
|
|
|
api: mios.api
|
|
|
|
});
|
|
|
|
|
2017-11-16 16:46:54 +02:00
|
|
|
(riot as any).mixin('stream', { stream: mios.stream });
|
|
|
|
(riot as any).mixin('drive-stream', { driveStream: new DriveStreamManager(mios.i) });
|
2017-11-15 20:06:52 +02:00
|
|
|
(riot as any).mixin('server-stream', { serverStream: new ServerStreamManager() });
|
|
|
|
(riot as any).mixin('requests-stream', { requestsStream: new RequestsStreamManager() });
|
2017-11-16 16:46:54 +02:00
|
|
|
(riot as any).mixin('messaging-index-stream', { messagingIndexStream: new MessagingIndexStreamManager(mios.i) });
|
2017-11-15 20:06:52 +02:00
|
|
|
};
|