(source, type, substitutions, userAction = true)
| 17 | * @param {Boolean} [userAction=true] - this log entry is the result of a direct user interaction on the Mailvelope UI |
| 18 | */ |
| 19 | export function push(source, type, substitutions, userAction = true) { |
| 20 | const entry = { |
| 21 | source, |
| 22 | sourcei18n: l10n.get(source), |
| 23 | type, |
| 24 | typei18n: l10n.get(type, substitutions), |
| 25 | timestamp: (new Date()).toISOString() |
| 26 | }; |
| 27 | const lastEntry = log[log.length - 1]; |
| 28 | if (lastEntry && |
| 29 | source === lastEntry.source && |
| 30 | type === lastEntry.type && |
| 31 | (type === 'security_log_textarea_input' || type === 'security_log_password_input')) { |
| 32 | // aggregate text input events |
| 33 | log[log.length - 1] = entry; |
| 34 | } else { |
| 35 | log.push(entry); |
| 36 | } |
| 37 | if (userAction) { |
| 38 | showIndicator(); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | function showIndicator(duration = 2000) { |
| 43 | if (logTimer) { |
nothing calls this directly
no test coverage detected