picosh 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -50,6 +50,7 @@ const PROMPT_RE = /❯\s*\?/;
|
|
|
50
50
|
const timers = {};
|
|
51
51
|
const waitingState = {};
|
|
52
52
|
let activeUid = null;
|
|
53
|
+
let promptActive = false;
|
|
53
54
|
|
|
54
55
|
function setWaiting(uid, waiting) {
|
|
55
56
|
if (!uid) return;
|
|
@@ -77,15 +78,18 @@ exports.middleware = () => (next) => (action) => {
|
|
|
77
78
|
|
|
78
79
|
clearTimeout(timers[uid]);
|
|
79
80
|
timers[uid] = setTimeout(() => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
if (PROMPT_RE.test(clean)) {
|
|
82
|
+
promptActive = true;
|
|
83
|
+
setWaiting(uid, true);
|
|
84
|
+
} else if (!promptActive) {
|
|
85
|
+
setWaiting(uid, false);
|
|
86
|
+
}
|
|
83
87
|
}, 300);
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
if (action.type === 'SESSION_USER_DATA') {
|
|
87
91
|
const uid = activeUid;
|
|
88
|
-
|
|
92
|
+
promptActive = false;
|
|
89
93
|
clearTimeout(timers[uid]);
|
|
90
94
|
setWaiting(uid, false);
|
|
91
95
|
}
|