Nui
Classes | Public Member Functions | Static Public Attributes | List of all members
Nui::RpcHub Class Reference

#include <rpc_hub.hpp>

Classes

struct  AutoUnregister
 

Public Member Functions

 RpcHub (Window &window)
 
 ~RpcHub ()=default
 
 RpcHub (const RpcHub &)=delete
 
RpcHuboperator= (const RpcHub &)=delete
 
 RpcHub (RpcHub &&)=delete
 
RpcHuboperator= (RpcHub &&)=delete
 
template<typename T >
AutoUnregister autoRegisterFunction (std::string const &name, T &&func) const
 
template<typename T >
void registerFunction (std::string const &name, T &&func) const
 
void unregisterFunction (std::string const &name) const
 
Windowwindow () const
 Returns the attached window. More...
 
template<typename... Args>
void callRemote (std::string const &name, Args &&... args) const
 For technical reasons these cannot return a value currently. More...
 
template<typename Arg >
void callRemote (std::string const &name, Arg &&arg) const
 
void callRemote (std::string const &name, nlohmann::json const &json) const
 
void callRemote (std::string const &name, nlohmann::json &&json) const
 
void callRemote (std::string const &name) const
 
template<typename... Args>
void call (std::string const &name, Args &&... args) const
 
void enableFileDialogs () const
 Enables file dialog functionality. More...
 
void enableFile ()
 Enables file class in the frontend. More...
 
void enableWindowFunctions () const
 Enables opening of the devTools, terminating the window from the view... More...
 
void enableFetch () const
 Enables fetch functionality. More...
 
void enableThrottle ()
 Enables the throttle functionality. More...
 
void enableTimer ()
 Enables the setInterval and setTimeout functionality. More...
 
void enableScreen ()
 Enables the screen functionality. More...
 
void enableEnvironmentVariables ()
 Enables the environment variable functionality. More...
 
void enableAll ()
 Enables all functionality. More...
 
template<typename ManagerT >
void * accessStateStore (std::string const &id)
 

Static Public Attributes

constexpr static char const * remoteCallScript
 

Constructor & Destructor Documentation

◆ RpcHub() [1/3]

Nui::RpcHub::RpcHub ( Window window)

◆ ~RpcHub()

Nui::RpcHub::~RpcHub ( )
default

◆ RpcHub() [2/3]

Nui::RpcHub::RpcHub ( const RpcHub )
delete

◆ RpcHub() [3/3]

Nui::RpcHub::RpcHub ( RpcHub &&  )
delete

Member Function Documentation

◆ accessStateStore()

template<typename ManagerT >
void* Nui::RpcHub::accessStateStore ( std::string const &  id)
inline

◆ autoRegisterFunction()

template<typename T >
AutoUnregister Nui::RpcHub::autoRegisterFunction ( std::string const &  name,
T &&  func 
) const
inline

◆ call()

template<typename... Args>
void Nui::RpcHub::call ( std::string const &  name,
Args &&...  args 
) const
inline

◆ callRemote() [1/5]

void Nui::RpcHub::callRemote ( std::string const &  name) const
inline

◆ callRemote() [2/5]

template<typename Arg >
void Nui::RpcHub::callRemote ( std::string const &  name,
Arg &&  arg 
) const
inline

◆ callRemote() [3/5]

template<typename... Args>
void Nui::RpcHub::callRemote ( std::string const &  name,
Args &&...  args 
) const
inline

For technical reasons these cannot return a value currently.

Template Parameters
Args
Parameters
name
args

◆ callRemote() [4/5]

void Nui::RpcHub::callRemote ( std::string const &  name,
nlohmann::json &&  json 
) const
inline

◆ callRemote() [5/5]

void Nui::RpcHub::callRemote ( std::string const &  name,
nlohmann::json const &  json 
) const
inline

◆ enableAll()

void Nui::RpcHub::enableAll ( )

Enables all functionality.

◆ enableEnvironmentVariables()

void Nui::RpcHub::enableEnvironmentVariables ( )

Enables the environment variable functionality.

◆ enableFetch()

void Nui::RpcHub::enableFetch ( ) const

Enables fetch functionality.

◆ enableFile()

void Nui::RpcHub::enableFile ( )

Enables file class in the frontend.

◆ enableFileDialogs()

void Nui::RpcHub::enableFileDialogs ( ) const

Enables file dialog functionality.

◆ enableScreen()

void Nui::RpcHub::enableScreen ( )

Enables the screen functionality.

◆ enableThrottle()

void Nui::RpcHub::enableThrottle ( )

Enables the throttle functionality.

◆ enableTimer()

void Nui::RpcHub::enableTimer ( )

Enables the setInterval and setTimeout functionality.

◆ enableWindowFunctions()

void Nui::RpcHub::enableWindowFunctions ( ) const

Enables opening of the devTools, terminating the window from the view...

◆ operator=() [1/2]

RpcHub& Nui::RpcHub::operator= ( const RpcHub )
delete

◆ operator=() [2/2]

RpcHub& Nui::RpcHub::operator= ( RpcHub &&  )
delete

◆ registerFunction()

template<typename T >
void Nui::RpcHub::registerFunction ( std::string const &  name,
T &&  func 
) const
inline

◆ unregisterFunction()

void Nui::RpcHub::unregisterFunction ( std::string const &  name) const
inline

◆ window()

Window& Nui::RpcHub::window ( ) const
inline

Returns the attached window.

Returns
Window&

Member Data Documentation

◆ remoteCallScript

constexpr static char const* Nui::RpcHub::remoteCallScript
staticconstexpr
Initial value:
= R"(
(function() {{
if (globalThis.nui_rpc.frontend.hasOwnProperty("{0}")) {{
globalThis.nui_rpc.frontend["{0}"]({1});
return;
}}
globalThis.nui_rpc.errors = globalThis.nui_rpc.errors || [];
globalThis.nui_rpc.errors.push("Function {0} does not exist.");
if (globalThis.nui_rpc.errors.length > 100) {{
globalThis.nui_rpc.errors.shift();
}}
}})();
)"

The documentation for this class was generated from the following files: