@@ -13,30 +13,30 @@ single [`run()`](#run) call that is controlled by the user.
13
13
14
14
* [ Quickstart example] ( #quickstart-example )
15
15
* [ Usage] ( #usage )
16
- * [ Loop] ( #loop )
17
- * [ get()] ( #get )
18
- * [ Factory] ( #factory )
19
- * [ create()] ( #create )
20
- * [ Loop implementations] ( #loop-implementations )
21
- * [ StreamSelectLoop] ( #streamselectloop )
22
- * [ ExtEventLoop] ( #exteventloop )
23
- * [ ExtLibeventLoop] ( #extlibeventloop )
24
- * [ ExtLibevLoop] ( #extlibevloop )
25
- * [ ExtEvLoop] ( #extevloop )
26
- * [ ExtUvLoop] ( #extuvloop )
27
- * [ LoopInterface] ( #loopinterface )
28
- * [ run()] ( #run )
29
- * [ stop()] ( #stop )
30
- * [ addTimer()] ( #addtimer )
31
- * [ addPeriodicTimer()] ( #addperiodictimer )
32
- * [ cancelTimer()] ( #canceltimer )
33
- * [ futureTick()] ( #futuretick )
34
- * [ addSignal()] ( #addsignal )
35
- * [ removeSignal()] ( #removesignal )
36
- * [ addReadStream()] ( #addreadstream )
37
- * [ addWriteStream()] ( #addwritestream )
38
- * [ removeReadStream()] ( #removereadstream )
39
- * [ removeWriteStream()] ( #removewritestream )
16
+ * [ Loop] ( #loop )
17
+ * [ get()] ( #get )
18
+ * [ ~~ Factory~~ ] ( #factory )
19
+ * [ ~~ create()~~ ] ( #create )
20
+ * [ Loop implementations] ( #loop-implementations )
21
+ * [ StreamSelectLoop] ( #streamselectloop )
22
+ * [ ExtEventLoop] ( #exteventloop )
23
+ * [ ExtLibeventLoop] ( #extlibeventloop )
24
+ * [ ExtLibevLoop] ( #extlibevloop )
25
+ * [ ExtEvLoop] ( #extevloop )
26
+ * [ ExtUvLoop] ( #extuvloop )
27
+ * [ LoopInterface] ( #loopinterface )
28
+ * [ run()] ( #run )
29
+ * [ stop()] ( #stop )
30
+ * [ addTimer()] ( #addtimer )
31
+ * [ addPeriodicTimer()] ( #addperiodictimer )
32
+ * [ cancelTimer()] ( #canceltimer )
33
+ * [ futureTick()] ( #futuretick )
34
+ * [ addSignal()] ( #addsignal )
35
+ * [ removeSignal()] ( #removesignal )
36
+ * [ addReadStream()] ( #addreadstream )
37
+ * [ addWriteStream()] ( #addwritestream )
38
+ * [ removeReadStream()] ( #removereadstream )
39
+ * [ removeWriteStream()] ( #removewritestream )
40
40
* [ Install] ( #install )
41
41
* [ Tests] ( #tests )
42
42
* [ License] ( #license )
@@ -84,7 +84,7 @@ and run at the end of the program.
84
84
85
85
``` php
86
86
// [1]
87
- $loop = React\EventLoop\Factory::create();
87
+ $loop = React\EventLoop\Loop::get(); // or deprecated React\EventLoop\ Factory::create();
88
88
89
89
// [2]
90
90
$loop->addPeriodicTimer(1, function () {
@@ -100,9 +100,10 @@ $stream = new React\Stream\ReadableResourceStream(
100
100
$loop->run();
101
101
```
102
102
103
- 1 . The loop instance is created at the beginning of the program. A convenience
104
- factory [ ` React\EventLoop\Factory::create() ` ] ( #create ) is provided by this library which
105
- picks the best available [ loop implementation] ( #loop-implementations ) .
103
+ 1 . The loop instance is created at the beginning of the program. This is
104
+ implicitly done the first time you call the [ ` Loop ` class] ( #loop ) or
105
+ explicitly when using the deprecated [ ` Factory::create() method ` ] ( #create )
106
+ (or manually instantiating any of the [ loop implementation] ( #loop-implementations ) ).
106
107
2 . The loop instance is used directly or passed to library and application code.
107
108
In this example, a periodic timer is registered with the event loop which
108
109
simply outputs ` Tick ` every second and a
@@ -134,18 +135,26 @@ Loop::get()->addTimer(0.01, function () {
134
135
Loop::get()->run();
135
136
```
136
137
137
- ### Factory
138
+ ### ~~ Factory~~
139
+
140
+ > Deprecated since v1.2.0, see [ ` Loop ` class] ( #loop ) instead.
138
141
139
- The ` Factory ` class exists as a convenient way to pick the best available
142
+ The deprecated ` Factory ` class exists as a convenient way to pick the best available
140
143
[ event loop implementation] ( #loop-implementations ) .
141
144
142
- #### create()
145
+ #### ~~ create()~~
143
146
144
- The ` create(): LoopInterface ` method can be used to create a new event loop
145
- instance:
147
+ > Deprecated since v1.2.0, see [ ` Loop::get() ` ] ( #get ) instead.
148
+
149
+ The deprecated ` create(): LoopInterface ` method can be used to
150
+ create a new event loop instance:
146
151
147
152
``` php
153
+ // deprecated
148
154
$loop = React\EventLoop\Factory::create();
155
+
156
+ // new
157
+ $loop = React\EventLoop\Loop::get();
149
158
```
150
159
151
160
This method always returns an instance implementing [ ` LoopInterface ` ] ( #loopinterface ) ,
0 commit comments