Jquery mobile requirejs随机事件未被触发的事件

时间:2014-03-05 21:24:25

标签: jquery jquery-mobile

这很奇怪。好像那些pageinit事件不会一直被解雇。当我刷新页面时,他们不会再被解雇,直到很长一段时间(或者也许是随机的)。

有缓存吗?这可能是一个问题...我不知道是什么(我猜这就是为什么我在这里问这个问题)?

正如您所看到的,我正在使用requirejs来构建我的代码。再一次,我猜的实际代码很好,它实际上只是每次都不一样。

define(["jquery", "jquery-mobile", "app/RestaurantCollection"], function($, jqm, restaurantCollection) {

/**
 * Init all the event handlers that need to be present on the overview page
 * @return {[type]} [description]
 */
function initOverview() {

    console.log("init overview as function")

    $(document).on("pageinit", "#restaurant", function(event) {
        console.log("init detail")
    });

    $(document).on("pageinit", "#page-overview", function(event) {
        console.log("init overview")
        restaurantCollection.init();
    });

}

return {
    initOverview: initOverview
}
});

0 个答案:

没有答案