(type, data, isBlocking)
| 38 | |
| 39 | // adds a new action, calls its handler and |
| 40 | const dispatch = (type, data, isBlocking) => { |
| 41 | |
| 42 | // is blocking action (should never block if document is hidden) |
| 43 | if (isBlocking && !document.hidden) { |
| 44 | dispatchQueue.push({ type, data }); |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | // if this action has a handler, handle the action |
| 49 | if (actionHandlers[type]) { |
| 50 | actionHandlers[type](data); |
| 51 | } |
| 52 | |
| 53 | // now add action |
| 54 | actionQueue.push({ |
| 55 | type, |
| 56 | data |
| 57 | }); |
| 58 | }; |
| 59 | |
| 60 | const query = (str, ...args) => |
| 61 | queryHandles[str] ? queryHandles[str](...args) : null; |
no outgoing calls
no test coverage detected