Browse Source

flash_controller console log

main
pvincent 5 days ago
parent
commit
bac0eed0c7
  1. 32
      app/javascript/controllers/flash_controller.js

32
app/javascript/controllers/flash_controller.js

@ -11,12 +11,6 @@ export default class extends Controller {
offset: { y: 30 },
}
count = 1
connect() {
console.log('FLASH stimulus ready!')
}
icon(drawing) {
return `<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current mx-4" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${drawing}" />
@ -34,14 +28,16 @@ export default class extends Controller {
popup(event) {
const { type, message } = event.detail
switch (type) {
case 'notice':
this.notice(message)
break
case 'alert':
this.alert(message)
break
default:
console.error(`undefined popup message type: ${type}`)
case 'notice': this.notice(message); break
case 'alert': this.alert(message); break
default: console.error(`undefined popup message type: ${type}`)
}
}
log(type, message) {
switch (type) {
case 'notice': console.info(`FLASH:${type} <${message}>`); break
case 'alert': console.warn(`FLASH:${type} <${message}>`); break
}
}
@ -51,7 +47,7 @@ export default class extends Controller {
text: this.textNotice(message),
className: this.classNameNotice(),
}).showToast();
console.info(message)
this.log('notice', message)
}
alert(message) {
@ -60,11 +56,7 @@ export default class extends Controller {
text: this.textAlert(message),
className: this.classNameAlert(),
}).showToast();
console.warn(message)
}
random() {
console.warn('show randow')
this.log('alert', message)
}
}
Loading…
Cancel
Save