|
1 |
| -/* |
2 |
| - * Test Steps Explained |
3 |
| - * ==================== |
4 |
| - * |
5 |
| - * Initializing hooks: |
6 |
| - * |
7 |
| - * We initialize 3 hooks. For hook2 and hook3 we register a callback for the |
8 |
| - * "before" and in case of hook3 also for the "after" invocations. |
9 |
| - * |
10 |
| - * Enabling hooks initially: |
11 |
| - * |
12 |
| - * We only enable hook1 and hook3 initially. |
13 |
| - * |
14 |
| - * Enabling hook2: |
15 |
| - * |
16 |
| - * When hook3's "before" invocation occurs we enable hook2. Since this |
17 |
| - * happens right before calling `onfirstImmediate` hook2 will miss all hook |
18 |
| - * invocations until then, including the "init" and "before" of the first |
19 |
| - * Immediate. |
20 |
| - * However afterwards it collects all invocations that follow on the first |
21 |
| - * Immediate as well as all invocations on the second Immediate. |
22 |
| - * |
23 |
| - * This shows that a hook can enable another hook inside a life time event |
24 |
| - * callback. |
25 |
| - * |
26 |
| - * |
27 |
| - * Disabling hook1 |
28 |
| - * |
29 |
| - * Since we registered the "before" callback for hook2 it will execute it |
30 |
| - * right before `onsecondImmediate` is called. |
31 |
| - * At that point we disable hook1 which is why it will miss all invocations |
32 |
| - * afterwards and thus won't include the second "after" as well as the |
33 |
| - * "destroy" invocations |
34 |
| - * |
35 |
| - * This shows that a hook can disable another hook inside a life time event |
36 |
| - * callback. |
37 |
| - * |
38 |
| - * Disabling hook3 |
39 |
| - * |
40 |
| - * When the second "after" invocation occurs (after onsecondImmediate), hook3 |
41 |
| - * disables itself. |
42 |
| - * As a result it will not receive the "destroy" invocation. |
43 |
| - * |
44 |
| - * This shows that a hook can disable itself inside a life time event callback. |
45 |
| - * |
46 |
| - * Sample Test Log |
47 |
| - * =============== |
48 |
| - * |
49 |
| - * - setting up first Immediate |
50 |
| - * hook1.init.uid-5 |
51 |
| - * hook3.init.uid-5 |
52 |
| - * - finished setting first Immediate |
53 |
| -
|
54 |
| - * hook1.before.uid-5 |
55 |
| - * hook3.before.uid-5 |
56 |
| - * - enabled hook2 |
57 |
| - * - entering onfirstImmediate |
58 |
| -
|
59 |
| - * - setting up second Immediate |
60 |
| - * hook1.init.uid-6 |
61 |
| - * hook3.init.uid-6 |
62 |
| - * hook2.init.uid-6 |
63 |
| - * - finished setting second Immediate |
| 1 | +// Test Steps Explained |
| 2 | +// ==================== |
| 3 | +// |
| 4 | +// Initializing hooks: |
| 5 | +// |
| 6 | +// We initialize 3 hooks. For hook2 and hook3 we register a callback for the |
| 7 | +// "before" and in case of hook3 also for the "after" invocations. |
| 8 | +// |
| 9 | +// Enabling hooks initially: |
| 10 | +// |
| 11 | +// We only enable hook1 and hook3 initially. |
| 12 | +// |
| 13 | +// Enabling hook2: |
| 14 | +// |
| 15 | +// When hook3's "before" invocation occurs we enable hook2. Since this |
| 16 | +// happens right before calling `onfirstImmediate` hook2 will miss all hook |
| 17 | +// invocations until then, including the "init" and "before" of the first |
| 18 | +// Immediate. |
| 19 | +// However afterwards it collects all invocations that follow on the first |
| 20 | +// Immediate as well as all invocations on the second Immediate. |
| 21 | +// |
| 22 | +// This shows that a hook can enable another hook inside a life time event |
| 23 | +// callback. |
| 24 | +// |
| 25 | +// |
| 26 | +// Disabling hook1 |
| 27 | +// |
| 28 | +// Since we registered the "before" callback for hook2 it will execute it |
| 29 | +// right before `onsecondImmediate` is called. |
| 30 | +// At that point we disable hook1 which is why it will miss all invocations |
| 31 | +// afterwards and thus won't include the second "after" as well as the |
| 32 | +// "destroy" invocations |
| 33 | +// |
| 34 | +// This shows that a hook can disable another hook inside a life time event |
| 35 | +// callback. |
| 36 | +// |
| 37 | +// Disabling hook3 |
| 38 | +// |
| 39 | +// When the second "after" invocation occurs (after onsecondImmediate), hook3 |
| 40 | +// disables itself. |
| 41 | +// As a result it will not receive the "destroy" invocation. |
| 42 | +// |
| 43 | +// This shows that a hook can disable itself inside a life time event callback. |
| 44 | +// |
| 45 | +// Sample Test Log |
| 46 | +// =============== |
| 47 | +// |
| 48 | +// - setting up first Immediate |
| 49 | +// hook1.init.uid-5 |
| 50 | +// hook3.init.uid-5 |
| 51 | +// - finished setting first Immediate |
| 52 | +// |
| 53 | +// hook1.before.uid-5 |
| 54 | +// hook3.before.uid-5 |
| 55 | +// - enabled hook2 |
| 56 | +// - entering onfirstImmediate |
| 57 | +// |
| 58 | +// - setting up second Immediate |
| 59 | +// hook1.init.uid-6 |
| 60 | +// hook3.init.uid-6 |
| 61 | +// hook2.init.uid-6 |
| 62 | +// - finished setting second Immediate |
| 63 | +// |
| 64 | +// - exiting onfirstImmediate |
| 65 | +// hook1.after.uid-5 |
| 66 | +// hook3.after.uid-5 |
| 67 | +// hook2.after.uid-5 |
| 68 | +// hook1.destroy.uid-5 |
| 69 | +// hook3.destroy.uid-5 |
| 70 | +// hook2.destroy.uid-5 |
| 71 | +// hook1.before.uid-6 |
| 72 | +// hook3.before.uid-6 |
| 73 | +// hook2.before.uid-6 |
| 74 | +// - disabled hook1 |
| 75 | +// - entering onsecondImmediate |
| 76 | +// - exiting onsecondImmediate |
| 77 | +// hook3.after.uid-6 |
| 78 | +// - disabled hook3 |
| 79 | +// hook2.after.uid-6 |
| 80 | +// hook2.destroy.uid-6 |
64 | 81 |
|
65 |
| - * - exiting onfirstImmediate |
66 |
| - * hook1.after.uid-5 |
67 |
| - * hook3.after.uid-5 |
68 |
| - * hook2.after.uid-5 |
69 |
| - * hook1.destroy.uid-5 |
70 |
| - * hook3.destroy.uid-5 |
71 |
| - * hook2.destroy.uid-5 |
72 |
| - * hook1.before.uid-6 |
73 |
| - * hook3.before.uid-6 |
74 |
| - * hook2.before.uid-6 |
75 |
| - * - disabled hook1 |
76 |
| - * - entering onsecondImmediate |
77 |
| - * - exiting onsecondImmediate |
78 |
| - * hook3.after.uid-6 |
79 |
| - * - disabled hook3 |
80 |
| - * hook2.after.uid-6 |
81 |
| - * hook2.destroy.uid-6 |
82 |
| - */ |
83 | 82 |
|
84 | 83 | 'use strict';
|
85 | 84 |
|
|
0 commit comments