using System;
using System.Globalization;
namespace ElectronNET.API
{
///
/// Generic Event Consumers for Electron Modules
///
internal class Events
{
private static Events _events;
private static object _syncRoot = new object();
private TextInfo _ti = new CultureInfo("en-US", false).TextInfo;
private Events()
{
}
public static Events Instance
{
get
{
if (_events == null)
{
lock (_syncRoot)
{
if (_events == null)
{
_events = new Events();
}
}
}
return _events;
}
}
///
/// Subscribe to an unmapped electron event.
///
/// The name of the module, e.g. app, dock, etc...
/// The name of the event
/// The event handler
public void On(string moduleName, string eventName, Action fn) => On(moduleName, eventName, _ => fn());
///
/// Subscribe to an unmapped electron event.
///
/// The name of the module, e.g. app, dock, etc...
/// The name of the event
/// The event handler
public void On(string moduleName, string eventName, Action