Home Manual Reference Source Repository
import Util from 'netflux/src/Util.js'
public class | source

Util

Utility class contains some helper static methods.

Static Member Summary

Static Public Members
public static get
public static get
public static get

Static Method Summary

Static Public Methods
public static

createCloseEvent(code: number, reason: string, wasClean: boolean): CloseEvent | NodeCloseEvent

Create CloseEvent.

public static

Check execution environment.

public static

Check whether the channel is a socket.

public static

isURL(str: string): type

Check whether the string is a valid URL.

public static

require(module: *): *

public static

requireLib(libConst: *): *

Static Public Members

public static get TEXT_ENCODING_LIB: number source

public static get WEB_RTC_LIB: number source

public static get WEB_SOCKET_LIB: number source

Static Public Methods

public static createCloseEvent(code: number, reason: string, wasClean: boolean): CloseEvent | NodeCloseEvent source

Create CloseEvent.

Params:

NameTypeAttributeDescription
code number
reason string
  • optional
  • default:
wasClean boolean
  • optional
  • default: true

Return:

CloseEvent | NodeCloseEvent

public static isBrowser(): boolean source

Check execution environment.

Return:

boolean

Description

public static isSocket(channel: WebSocket | RTCDataChannel): boolean source

Check whether the channel is a socket.

Params:

NameTypeAttributeDescription
channel WebSocket | RTCDataChannel

Return:

boolean

public static isURL(str: string): type source

Check whether the string is a valid URL.

Params:

NameTypeAttributeDescription
str string

Return:

type

Description

public static require(module: *): * source

Params:

NameTypeAttributeDescription
module *

Return:

*

public static requireLib(libConst: *): * source

Params:

NameTypeAttributeDescription
libConst *

Return:

*