main.cesium.TrustedServers.kt Maven / Gradle / Ivy
// Automatically generated - do not modify!
@file:JsModule("cesium")
package cesium
/**
* A singleton that contains all of the servers that are trusted. Credentials will be sent with
* any requests to these servers.
* @see Online Documentation
*/
external object TrustedServers {
/**
* Adds a trusted server to the registry
* ```
* // Add a trusted server
* TrustedServers.add('my.server.com', 80);
* ```
* @param [host] The host to be added.
* @param [port] The port used to access the host.
* @see Online Documentation
*/
fun add(
host: String,
port: Int,
)
/**
* Removes a trusted server from the registry
* ```
* // Remove a trusted server
* TrustedServers.remove('my.server.com', 80);
* ```
* @param [host] The host to be removed.
* @param [port] The port used to access the host.
* @see Online Documentation
*/
fun remove(
host: String,
port: Int,
)
/**
* Tests whether a server is trusted or not. The server must have been added with the port if it is included in the url.
* ```
* // Add server
* TrustedServers.add('my.server.com', 81);
*
* // Check if server is trusted
* if (TrustedServers.contains('https://my.server.com:81/path/to/file.png')) {
* // my.server.com:81 is trusted
* }
* if (TrustedServers.contains('https://my.server.com/path/to/file.png')) {
* // my.server.com isn't trusted
* }
* ```
* @param [url] The url to be tested against the trusted list
* @return Returns true if url is trusted, false otherwise.
* @see Online Documentation
*/
fun contains(url: String): Boolean
/**
* Clears the registry
* ```
* // Remove a trusted server
* TrustedServers.clear();
* ```
* @see Online Documentation
*/
fun clear()
}