rx/presenters

View on GitHub
views/mdc/assets/js/components/events/post_message.js

Summary

Maintainability
A
0 mins
Test Coverage
export class VPostMessage {
    constructor(options, params, event, root) {
        this.params = params;
        this.event = event;
        this.root = root;
    }

    call(results) {
        return new Promise((resolve) => {
            console.log('Post Message: ' + this.params.message);
            window.parent.postMessage(this.params.message, '*');
            results.push({
                action: 'close_frame',
                statusCode: 200,
            });

            // Otherwise, proceed with the next action:
            return resolve(results);
        });
    }
}