1import { Controller } from "@hotwired/stimulus"; 2 3export default class extends Controller { 4 static values = { 5 clientId: String, 6 loginUri: String, 7 state: String, 8 }; 9 10 static targets = ["button"]; 11 12 connect() { 13 this.waitForGoogle(() => { 14 google.accounts.id.initialize({ 15 client_id: this.clientIdValue, 16 context: "signin", 17 ux_mode: "redirect", 18 login_uri: this.loginUriValue, 19 state: this.stateValue, 20 auto_prompt: false, 21 itp_support: true, 22 }); 23 24 google.accounts.id.renderButton(this.buttonTarget, { 25 type: "standard", 26 shape: "rectangular", 27 theme: "outline", 28 text: "continue_with", 29 size: "large", 30 width: 300, 31 logo_alignment: "left", 32 }); 33 }); 34 } 35 36 waitForGoogle(callback) { 37 if (typeof google !== "undefined" && google.accounts && google.accounts.id) { 38 callback(); 39 } else { 40 setTimeout(() => this.waitForGoogle(callback), 100); 41 } 42 } 43}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.