-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathFlatpickrJsHelper.cs
More file actions
33 lines (29 loc) · 831 Bytes
/
Copy pathFlatpickrJsHelper.cs
File metadata and controls
33 lines (29 loc) · 831 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
30
31
32
33
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Text;
namespace FlatpickrBlazor
{
public class FlatpickrJsHelper
{
private readonly Action<List<DateTimeOffset>> _onChange;
private readonly Action _onCreate;
public FlatpickrJsHelper(Action<List<DateTimeOffset>> onChange, Action onCreate)
{
_onChange = onChange;
_onCreate = onCreate;
}
public List<DateTimeOffset> DateTimes { get; set; }
[JSInvokable]
public void OnChange(DateTimeOffset[] dateTimes)
{
DateTimes = new List<DateTimeOffset>(dateTimes);
_onChange?.Invoke(DateTimes);
}
[JSInvokable]
public void OnCreate()
{
_onCreate?.Invoke();
}
}
}