共用方式為


initCloseEvent method

Initializes the close event.

 

Syntax

HRESULT retVal = object.initCloseEvent(typeArg, canBubbleArg, cancelableArg, wasCleanArg, codeArg, reasonArg);

Parameters

  • typeArg [in]
    Type: DOMString

    The type of the event being created.

  • canBubbleArg [in]
    Type: boolean

    Indicates whether the event can bubble. When true the event should propagate upward. When false the event does not propagate upward.

  • cancelableArg [in]
    Type: boolean

    Indicates whether the event’s default action can be prevented. When true, the default action can be canceled. When false, the default action cannot be canceled.

  • wasCleanArg [in]
    Type: boolean

    Represents whether the connection closed cleanly or not.

  • codeArg [in]
    Type: unsigned long

    Represents the WebSocket connection close code provided by the server.

  • reasonArg [in]
    Type: DOMString

    Represents the WebSocket connection close reason provided by the server.

Return value

Type: HRESULT

This method can return one of these values.

S_OK

Remarks

Initializes the event in a manner analogous to the similarly-named method in the DOM events.