Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
super();
this._router = router;
}
start() {
setTimeout(() => {
console.log("Sending results event for StaticDataA");
this._router.publishEvent('modelId', 'userStaticReceivedEvent', "StaticDataA");
}, 1000);
setTimeout(() => {
console.log("Sending results event for StaticDataB");
this._router.publishEvent('modelId', 'userStaticReceivedEvent', "StaticDataB");
}, 2000);
}
}
class StaticDataEventProcessor extends esp.DisposableBase {
constructor(router) {
super();
this._router = router;
}
initialise() {
this._listenForInitialiseEvent();
this._listenForStaticDataReceivedEvent();
}
_listenForInitialiseEvent() {
this.addDisposable(this._router
.getEventObservable('modelId', 'initialiseEvent')
.take(1)
.subscribe(() => {
console.log("Starting work item to get static data");
var getUserStaticWorkItem = new GetUserStaticDataWorkItem(this._router);
this.addDisposable(getUserStaticWorkItem);
var runAcyncOperationWithWorkItemExample = () => {
class GetUserStaticDataWorkItem extends esp.DisposableBase {
constructor(router) {
super();
this._router = router;
}
start() {
setTimeout(() => {
console.log("Sending results event for StaticDataA");
this._router.publishEvent('modelId', 'userStaticReceivedEvent', "StaticDataA");
}, 1000);
setTimeout(() => {
console.log("Sending results event for StaticDataB");
this._router.publishEvent('modelId', 'userStaticReceivedEvent', "StaticDataB");
}, 2000);
}
}
super();
this._router = router;
}
start() {
setTimeout(() => {
console.log("Sending results event for StaticDataA");
this._router.publishEvent('modelId', 'userStaticReceivedEvent', "StaticDataA");
}, 1000);
setTimeout(() => {
console.log("Sending results event for StaticDataB");
this._router.publishEvent('modelId', 'userStaticReceivedEvent', "StaticDataB");
}, 2000);
}
}
class StaticDataEventProcessor extends esp.DisposableBase {
constructor(router) {
super();
this._router = router;
}
initialise() {
this._listenForInitialiseEvent();
this._listenForStaticDataReceivedEvent();
}
_listenForInitialiseEvent() {
this.addDisposable(this._router
.getEventObservable('modelId', 'initialiseEvent')
.take(1)
.subscribe(() => {
console.log("Starting work item to get static data");
var getUserStaticWorkItem = new GetUserStaticDataWorkItem(this._router);
this.addDisposable(getUserStaticWorkItem);
var runAcyncOperationWithWorkItemExample = () => {
class GetUserStaticDataWorkItem extends esp.DisposableBase {
constructor(router) {
super();
this._router = router;
}
start() {
setTimeout(() => {
console.log("Sending results event for StaticDataA");
this._router.publishEvent('modelId', 'userStaticReceivedEvent', "StaticDataA");
}, 1000);
setTimeout(() => {
console.log("Sending results event for StaticDataB");
this._router.publishEvent('modelId', 'userStaticReceivedEvent', "StaticDataB");
}, 2000);
}
}
import esp from 'esp-js';
import MessageSection from './MessageSection';
import ThreadSection from './ThreadSection';
export default class ChatApp extends esp.DisposableBase {
constructor(messageService, router) {
super();
this._messageService = messageService;
this._router = router;
this.rawMessagesByThreadId = {};
this.selectedThreadId = null;
this.threadSection = new ThreadSection(router);
this.addDisposable(this.threadSection);
this.messageSection = new MessageSection(router, messageService);
this.addDisposable(this.threadSection);
}
initialise() {
this.addDisposable(this._router.observeEventsOn(this));
this.threadSection.initialise();
this.messageSection.initialise();
}
import esp from 'esp-js';
import Thread from './Thread'
export default class ThreadSection extends esp.DisposableBase {
constructor(router) {
super();
this._router = router;
this.threadsById = {};
this.sortedThreads = [];
this.unreadCount = {
value: 0,
isVisible: false
};
this.hasChanges = false;
}
initialise() {
this.addDisposable(this._router.observeEventsOn(this));
}
preProcess() {
this.hasChanges = false;
import esp from 'esp-js';
import Message from './Message';
export default class MessageSection extends esp.DisposableBase {
constructor(router, messageService) {
super();
this._router = router;
this._messageService = messageService;
this.sortedMessages = [];
this.threadName = null;
this.hasChanges = false;
}
initialise() {
this.addDisposable(this._router.observeEventsOn(this));
}
preProcess() {
this.hasChanges = false;
}
@esp.observeEvent('InitEvent', esp.ObservationStage.committed)
_observeThreadSelected(event, context, model) {
import esp from 'esp-js';
import Message from './Message';
export default class MessageSection extends esp.DisposableBase {
constructor(router, messageService) {
super();
this._router = router;
this._messageService = messageService;
this.sortedMessages = [];
this.threadName = null;
this.hasChanges = false;
}
initialise() {
this.addDisposable(this._router.observeEventsOn(this));
}
preProcess() {
this.hasChanges = false;
}
@esp.observeEvent('InitEvent', esp.ObservationStage.committed)
_observeThreadSelected(event, context, model) {
import esp from 'esp-js';
import MessageSection from './MessageSection';
import ThreadSection from './ThreadSection';
export default class ChatApp extends esp.DisposableBase {
constructor(messageService, router) {
super();
this._messageService = messageService;
this._router = router;
this.rawMessagesByThreadId = {};
this.selectedThreadId = null;
this.threadSection = new ThreadSection(router);
this.addDisposable(this.threadSection);
this.messageSection = new MessageSection(router, messageService);
this.addDisposable(this.threadSection);
}
initialise() {
this.addDisposable(this._router.observeEventsOn(this));
this.threadSection.initialise();
this.messageSection.initialise();
}
import esp from 'esp-js';
import Thread from './Thread'
export default class ThreadSection extends esp.DisposableBase {
constructor(router) {
super();
this._router = router;
this.threadsById = {};
this.sortedThreads = [];
this.unreadCount = {
value: 0,
isVisible: false
};
this.hasChanges = false;
}
initialise() {
this.addDisposable(this._router.observeEventsOn(this));
}
preProcess() {
this.hasChanges = false;