目录

ready()

功能

当DOM准备就绪时,指定一个函数来执行。

语法

eventer.ready(callback)

参数

范例

Example: document 准备就绪时,修改<p>元素的 text。

<!DOCTYPE html>
<html>

<head>
    <style>
p { color:red; }
    </style>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script>
    <script>
    require.config({
        baseUrl: "./",
        packages: [
            { name: "skylark", location: "../../../src/skylark" },
        ]
    });
    </script>
</head>
<p>Not loaded yet.</p>
<body>
    <script>
    require(["skylark/query","skylark/finder", "skylark/eventer"], function(query,finder, eventer) {
          eventer(document).ready(function () {
                query("p").text("The DOM is now loaded and can be manipulated.");
            });
    });
    </script>
</body>

</html>