Sha256: 8e7c6aa095daea325f3377c7009808a2598f45cfac7102d7bc9611bd5ba9de04

Contents?: true

Size: 876 Bytes

Versions: 6

Compression:

Stored size: 876 Bytes

Contents

export class VToggleVisibility  {
    constructor(options, params, event) {
        this.targetId = options.target;
        this.params = params;
        this.event = event;
    }

    call(results) {
        let targetId = this.targetId;
        let action = this.params.action;
        let promiseObj = new Promise(function (resolve) {
            console.log("Toggling visibility on: " + targetId);
            let elem = document.getElementById(targetId);
            if (action === 'show') {
                elem.classList.remove("v-hidden");
            } else if (action === 'hide') {
                elem.classList.add("v-hidden");
            } else {
                elem.classList.toggle("v-hidden");
            }
            results.push({action:'toggle_visibility', statusCode: 200});
            resolve(results);
        });
        return promiseObj;
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voom-presenters-0.1.13 views/mdc/assets/js/components/events/toggle_visibility.js
voom-presenters-0.1.12 views/mdc/assets/js/components/events/toggle_visibility.js
voom-presenters-0.1.11 views/mdc/assets/js/components/events/toggle_visibility.js
voom-presenters-0.1.10 views/mdc/assets/js/components/events/toggle_visibility.js
voom-presenters-0.1.9 views/mdc/assets/js/components/events/toggle_visibility.js
voom-presenters-0.1.8 views/mdc/assets/js/components/events/toggle_visibility.js