简体   繁体   English

如何在我的 JavaScript 中识别 Sys.UI._Timer?

[英]How do I identify Sys.UI._Timer in my JavaScript?

In my web page source code I have:在我的网页源代码中,我有:

Sys.Application.add_init(function() {
    $create(Sys.UI._Timer, {"enabled":true,"interval":300000,"uniqueID":"timerMain"}, null, null, $get("timerMain"));
});

What is Sys.UI._Timer ?什么是 Sys.UI._Timer ? Is it a .Net class on the server side?它是服务器端的 .Net 类吗?

Sys.UI._Timer is a class which resembles System.Web.UI.Timer server control but runs in client-side (using JS) which creates timer control using AJAX client library. Sys.UI._Timer是一个类似于System.Web.UI.Timer服务器控件但在客户端(使用 JS)运行的类,它使用 AJAX 客户端库创建计时器控件。 The default constructor definition of that class is shown below:该类的默认构造函数定义如下所示:

Sys.UI._Timer = function Sys$UI$_Timer(element) { 
   Sys.UI._Timer.initializeBase(this,[element]); 

   this._interval = 60000; // Interval property, measured in milliseconds
   this._enabled = true;   // Enabled property 
   this._uniqueID = null; // UniqueID property

   // client-side only properties
   this._postbackPending = false; 
   this._raiseTickDelegate = null; 
   this._endRequestHandlerDelegate = null; 
   this._timer = null; 
   this._pageRequestManager = null;
}

Note that $create is shorthand from Sys.Component.create static method, which creates (and also initializes) a component with specified type as parameter (in this case, Sys.UI._Timer ).请注意, $createSys.Component.create静态方法的简写,它创建(并初始化)具有指定类型作为参数的组件(在本例中为Sys.UI._Timer )。 The property values you want to set into component properties must be provided in JSON format and property names usage are given without underscores (hence _interval becomes just interval ), using this syntax:您要设置到组件属性中的属性值必须以 JSON 格式提供,并且属性名称的用法不带下划线(因此_interval变成只是interval ),使用以下语法:

$create(type, { "propertyName": value, ... }, events, references, $get(elementName));

Further reading:进一步阅读:

Sys.UI._Timer - ASP.NET AJAX Client Library Sys.UI._Timer - ASP.NET AJAX 客户端库

Sys.UI Namespace - MS Docs Sys.UI 命名空间 - MS Docs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM