forked from neuecc/UniRx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Observable.Events.cs
34 lines (29 loc) · 1.47 KB
/
Observable.Events.cs
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
30
31
32
33
34
using System;
using UniRx.Operators;
namespace UniRx
{
public static partial class Observable
{
public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
where TEventArgs : EventArgs
{
return new FromEventPatternObservable<TDelegate, TEventArgs>(conversion, addHandler, removeHandler);
}
public static IObservable<Unit> FromEvent<TDelegate>(Func<Action, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
{
return new FromEventObservable<TDelegate>(conversion, addHandler, removeHandler);
}
public static IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
{
return new FromEventObservable<TDelegate, TEventArgs>(conversion, addHandler, removeHandler);
}
public static IObservable<Unit> FromEvent(Action<Action> addHandler, Action<Action> removeHandler)
{
return new FromEventObservable(addHandler, removeHandler);
}
public static IObservable<T> FromEvent<T>(Action<Action<T>> addHandler, Action<Action<T>> removeHandler)
{
return new FromEventObservable_<T>(addHandler, removeHandler);
}
}
}