document.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:wdom 作者: miyakogi 项目源码 文件源码
def __init__(self, *,
                 doctype: str = 'html',
                 title: str = 'W-DOM',
                 charset: str = 'utf-8',
                 default_class: type = WdomElement,
                 autoreload: bool = None,
                 reload_wait: float =None,
                 **kwargs: Any) -> None:
        """Create new document object for WDOM application.

        .. caution::

            Don't create new document from :class:`WdomDocument` class
            constructor. Use :func:`get_new_document` function instead.

        :arg str doctype: doctype of the document (default: html).
        :arg str title: title of the document.
        :arg str charset: charset of the document.
        :arg type default_class: Set default Node class of the document. This
            class is used when make node by :py:meth:`createElement()`
        :arg bool autoreload: Enable/Disable autoreload (default: False).
        :arg float reload_wait: How long (seconds) wait to reload. This
            parameter is only used when autoreload is enabled.
        """
        self.__tempdir = _tempdir = tempfile.mkdtemp()
        self._finalizer = weakref.finalize(self,  # type: ignore
                                           partial(_cleanup, _tempdir))
        self._autoreload = autoreload
        self._reload_wait = reload_wait

        super().__init__(doctype=doctype, default_class=default_class)
        self.characterSet = charset
        self.title = title
        self.script = Script(parent=self.body)
        self._autoreload_script = Script(parent=self.head)
        self.addEventListener('mount', self._on_mount)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号