mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
// PageMethods.js
|
|
|
|
var displayElement;
|
|
var valueElement;
|
|
|
|
// Initializes global variables and session state.
|
|
function pageLoad()
|
|
{
|
|
displayElement = $get("ResultId");
|
|
valueElement = $get("ValueId");
|
|
PageMethods.SetSessionValue("SessionValue", Date(),
|
|
OnSucceeded, OnFailed);
|
|
}
|
|
|
|
// Gets the session state value.
|
|
function GetSessionValue(key)
|
|
{
|
|
PageMethods.GetSessionValue(key,
|
|
OnSucceeded, OnFailed);
|
|
}
|
|
|
|
//Sets the session state value.
|
|
function SetSessionValue(key, value)
|
|
{
|
|
PageMethods.SetSessionValue(key, value,
|
|
OnSucceeded, OnFailed);
|
|
}
|
|
|
|
// Callback function invoked on successful
|
|
// completion of the page method.
|
|
function OnSucceeded(result, userContext, methodName)
|
|
{
|
|
if (methodName == "GetSessionValue")
|
|
{
|
|
displayElement.innerHTML = "Current session state value: " +
|
|
result;
|
|
}
|
|
else
|
|
{
|
|
valueElement.innerHTML = "Session state value was sent: "+result;
|
|
}
|
|
}
|
|
|
|
// Callback function invoked on failure
|
|
// of the page method.
|
|
function OnFailed(error, userContext, methodName)
|
|
{
|
|
if(error !== null)
|
|
{
|
|
displayElement.innerHTML = "An error occurred: " +
|
|
error.get_message();
|
|
}
|
|
}
|
|
|
|
if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
|
|
|