PHP Classes

File: assets/controllers/refresh_controller.js

Recommend this page to a friend!
  Packages of Julio Vergara   GitHub API   assets/controllers/refresh_controller.js   Download  
File: assets/controllers/refresh_controller.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GitHub API
Present the most starred PHP projects in GitHub
Author: By
Last change:
Date: 6 days ago
Size: 796 bytes
 

Contents

Class file image Download
import { Controller } from '@hotwired/stimulus'; export default class extends Controller { static targets = ['button', 'label', 'spinner']; connect() { this.element.addEventListener('turbo:submit-start', this.start.bind(this)); this.element.addEventListener('turbo:submit-end', this.stop.bind(this)); } start() { this.buttonTarget.disabled = true; this.buttonTarget.classList.add('loading'); this.spinnerTarget.style.display = 'inline-block'; this.labelTarget.textContent = 'Fetching...'; } stop() { this.buttonTarget.disabled = false; this.buttonTarget.classList.remove('loading'); this.spinnerTarget.style.display = 'none'; this.labelTarget.textContent = 'Refresh from GitHub'; } }