JSDoc: Source: abstract_postable.js

# Source: abstract_postable.js

    /*************************************************************
     *
     *  Copyright (c) 2015-2016 The MathJax Consortium
     *
     *  Licensed under the Apache License, Version 2.0 (the "License");
     *  you may not use this file except in compliance with the License.
     *  You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
     *  Unless required by applicable law or agreed to in writing, software
     *  distributed under the License is distributed on an "AS IS" BASIS,
     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     *  See the License for the specific language governing permissions and
     *  limitations under the License.
     */
    /**
     * @fileoverview Abstract class of context menus.
     *
     * @author volker.sorge@gmail.com (Volker Sorge)
     */
    /// <reference path="menu.ts" />
    /// <reference path="menu_element.ts" />
    /// <reference path="item.ts" />
    /// <reference path="variable_pool.ts" />
    var ContextMenu;
    (function (ContextMenu) {
        class AbstractPostable extends ContextMenu.MenuElement {
            /**
             * @constructor
             * @extends {MenuElement}
             * @implements {Postable}
             */
            constructor(...args) {
                super(...args);
                this.posted = false;
            }
            /**
             * @override
             */
            isPosted() {
                return this.posted;
            }
            /**
             * @override
             */
            post(x, y) {
                if (this.posted) {
                    return;
                }
                if (typeof (x) !== 'undefined' && typeof (y) !== 'undefined') {
                    this.getHtml().setAttribute('style', 'left: ' + x + 'px; top: ' + y + 'px;');
                }
                this.display();
                this.posted = true;
            }
            /**
             * @override
             */
            unpost() {
                if (!this.posted) {
                    return;
                }
                let html = this.getHtml();
                if (html.parentNode) {
                    html.parentNode.removeChild(html);
                }
                this.posted = false;
            }
        }
        ContextMenu.AbstractPostable = AbstractPostable;
    })(ContextMenu || (ContextMenu = {}));