zoukankan      html  css  js  c++  java
  • Sys.Application.add_load Fires On Each Callback

    ASP.NETAjax comes with a nice way to attach to a load event of a page. To doit just call Sys.Application.add_load and pass it a function as anargument. Done. Everything works as expected... WRONG!

    It comes out that add_load fires on each callback and not only whenthe page loads for the first time. That is of course a problem if youwant something to happen on page load only.

    From what I've been able to learn, this behavior is by design.Although it is never mentioned in a strigh forward way in a description:

    "Raised after all scripts have been loaded and after the objects in the application have been created and initialized."

    There are some places in the documentation, that suggests that thisis a way it was intended to be. First of all, ASP.NET Ajax tries tomimic that ASP.NET Page life cycle and as such, fires the load eventevery time there is a callback. The other thing that makes me believe,that load's behavior is there by design is this:

    "You can use the event arguments to determine whether the page isbeing refreshed as a result of a partial-page update and whatcomponents were created since the previous load event was raised."

    So now I know, but I still cannot accept the naming convention.Sys.Application plainly suggests, it's a kind of singleton, and not aper load thingy.

  • 相关阅读:
    codeforces 1140D(区间dp/思维题)
    区间dp之四边形不等式优化详解及证明
    poj1947
    hdu4044
    poj1155
    poj3162(树形dp+优先队列)
    hdu4003详解(树形dp+多组背包)
    poj1947(树形背包)
    hdu1011(树形背包)(提供一个特殊样例)
    CopyOnWriteArrayList总结
  • 原文地址:https://www.cnblogs.com/CodingPerfectWorld/p/1788029.html
Copyright © 2011-2022 走看看