// Copyright © 2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
namespace CefSharp.Example
{
///
/// A class that is used to demonstrate how asynchronous javascript events can be returned to the .Net runtime environment.
///
///
///
public class ScriptedMethodsBoundObject
{
///
/// Raised when a Javascript event arrives.
///
public event Action EventArrived;
///
/// This method will be exposed to the Javascript environment. It is
/// invoked in the Javascript environment when some event of interest
/// happens.
///
/// The name of the event.
/// Data provided by the invoker pertaining to the event.
///
/// By default RaiseEvent will be translated to raiseEvent as a javascript function.
/// This is configurable when calling RegisterJsObject by setting camelCaseJavascriptNames;
///
public void RaiseEvent(string eventName, object eventData = null)
{
if (EventArrived != null)
{
EventArrived(eventName, eventData);
}
}
}
}