How to use the esp-js.DisposableBase function in esp-js

To help you get started, we’ve selected a few esp-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github esp / esp-js / examples / esp-js-api / app.js View on Github external
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);
github esp / esp-js / examples / esp-js-api / app.js View on Github external
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);
        }
    }
github esp / esp-js / packages / esp-js / examples / api / app.js View on Github external
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);
github esp / esp-js / packages / esp-js / examples / api / app.js View on Github external
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);
        }
    }
github esp / esp-js / examples / esp-js-chat-react-es6 / js / model / ChatApp.js View on Github external
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();
    }
github esp / esp-js / packages / esp-js / examples / esp-chat-react-es6 / js / model / ThreadSection.js View on Github external
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;
github esp / esp-js / examples / esp-js-chat-react-es6 / js / model / MessageSection.js View on Github external
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) {
github esp / esp-js / packages / esp-js / examples / esp-chat-react-es6 / js / model / MessageSection.js View on Github external
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) {
github esp / esp-js / packages / esp-js / examples / esp-chat-react-es6 / js / model / ChatApp.js View on Github external
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();
    }
github esp / esp-js / examples / esp-js-chat-react-es6 / js / model / ThreadSection.js View on Github external
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;