-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTestEvents.cs
More file actions
29 lines (25 loc) · 881 Bytes
/
TestEvents.cs
File metadata and controls
29 lines (25 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
namespace Nahoum.UnityJSInterop.Tests
{
/// <summary>
/// Test exposing events
/// </summary>
public class TestEvents
{
[ExposeWeb]
public static TestEvents GetNewInstance() => new TestEvents();
// Try the "property style"
[ExposeWeb]
public event Action<string> TestEventStringAuto = delegate { };
// Try the "manual style" with add and remove
public event Action<string> _eventManual = delegate { };
public event Action<string> TestEventStringManual { [ExposeWeb] add { _eventManual += value; } [ExposeWeb] remove { _eventManual -= value; } }
// Triggers the event for testing purposes
[ExposeWeb]
public void InvokeEvent(string value)
{
TestEventStringAuto.Invoke(value);
_eventManual.Invoke(value);
}
}
}