Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Gọi người đăng ký được liên kết cho sự kiện.
Lưu ý
Nếu bạn đã tạo các sự kiện tùy chỉnh bằng phương thức addHandler, thì bạn có thể nêu các sự kiện đó bằng cách chuyển tên sự kiện dưới dạng tham số trong phương thức này.
Cú pháp
Microsoft.CIFramework.raiseEvent(eventName, eventInputParameters, correlationId);
Thông số
| Tên | Type | Bắt buộc | Description |
|---|---|---|---|
| tên sự kiện | Xâu | Có | Tên của sự kiện có trình xử lý cần được gọi. |
| eventInputParameters | Chuỗi JSON | Có | Các tham số đầu vào cần được chuyển đến hàm xử lý. |
| CorrelationId | GUID | Không | Được sử dụng để nhóm tất cả các lệnh gọi API liên quan lại với nhau để đo từ xa chẩn đoán. |
Giá trị trả về
Promise với giá trị là Boolean.
Example
// Let there be an event registered to a subscriber.
handlerFunction = function(eventInput)
{
console.log(eventInput);
if(eventInput != null && eventInput != undefined && eventInput.size > 0)
{
inputData = eventInput.get("value");
correlationId = eventInput.get("correlationId");
console.log(inputData + " " + correlationId);
}
return Promise.resolve();
}
Microsoft.CIFramework.addHandler("oncustomevent", handlerFunction);
//Use raiseEvent API to invoke the subscribed handler of the event.
Microsoft.CIFramework.raiseEvent("oncustomevent", "test input value");
//In the main UCI page
Microsoft.CIFramework.addHandler("widgetEvent", handlerFunction);
///In the widget code
Microsoft.CIFramework.raiseEvent("widgetEvent", eventInput);
//In the widget code
Microsoft.CIFramework.addHandler("mainPageEvent", handlerFunction);
//In the main UCI page
Microsoft.CIFramework.raiseEvent("mainPageEvent", eventInput);
Thông tin liên quan
addHandler
sự kiện onclicktoact
sự kiện onmodechanged
sự kiện onSizeChanged
sự kiện onpagenavigate
sự kiện onsendkbarticle
sự kiện onSessionClosed
sự kiện onSessionSwitched
sự kiện onPresenceChange