Skip to content

Commit f74b96b

Browse files
committed
Moved demo code into own file.
1 parent 23a5b46 commit f74b96b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/fs_demo.erl

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-module(fs_demo).
2+
3+
-include_lib("fs/include/const.hrl").
4+
5+
-export([start_looper/0,
6+
start_looper/1]).
7+
8+
% sample subscriber
9+
10+
start_looper() -> start_looper(?DEFAULT_NAME).
11+
12+
start_looper(Name) ->
13+
spawn(fun () ->
14+
subscribe(Name),
15+
loop()
16+
end).
17+
18+
loop() ->
19+
receive
20+
{_Pid, {fs, file_event}, {Path, Flags}} ->
21+
error_logger:info_msg("file_event: ~p ~p",
22+
[Path, Flags]);
23+
_ -> ignore
24+
end,
25+
loop().

0 commit comments

Comments
 (0)