feat: voucher purchase flow
This commit is contained in:
1 parent
a628e96d06
commit
f3dd122678
70 files changed
+3672
-122
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import {Controller} from '@hotwired/stimulus'
|
||||
|
||||
/*
|
||||
* Shows an indicator over an iframe until its content has loaded.
|
||||
*
|
||||
* The controller sets the frame's src itself, after the load listener is attached, so a fast
|
||||
* response cannot finish before anybody listens.
|
||||
*/
|
||||
export default class extends Controller {
|
||||
static targets = ['frame', 'indicator']
|
||||
static values = {src: String}
|
||||
|
||||
connect() {
|
||||
this.loaded = this.loaded.bind(this)
|
||||
this.frameTarget.addEventListener('load', this.loaded)
|
||||
this.frameTarget.src = this.srcValue
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.frameTarget.removeEventListener('load', this.loaded)
|
||||
}
|
||||
|
||||
loaded() {
|
||||
this.indicatorTarget.classList.add('hidden')
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user