1import { Controller } from '@hotwired/stimulus'; 2 3// ì´ ì»¨í¸ë¡¤ë¬ë ë¤ì´ë¡ë ë§í¬ë¥¼ í´ë¦í ë ìë²ì HEAD ìì²ì ë³´ë´ê³ , 4// ìë²ê° 202 ìëµì ë³´ë´ë©´ ì ì íì ë¤ì ìì²ì ìëíë¼ê³ ì립ëë¤. 5// ìë²ê° 200 ìëµì ë³´ë´ë©´ ë¤ì´ë¡ë를 ììí©ëë¤. 6/** 7 * @domain ëë©ì¸ ìí¬íë¡ì° 8 * @concern ë¤ì´ë¡ë ì¤ë¹ ìí íì¸ í íì¼ ë¤ì´ë¡ë í¸ë¦¬ê±° 9 * @description ë¤ì´ë¡ë ë§í¬ í´ë¦ ì ìë²ì HEAD ìì²ì ë³´ë´ 200ì´ë©´ ì¦ì ë¤ì´ë¡ë를 í¸ë¦¬ê±°íê³ , 202ë©´ ì¤ë¹ ì¤ ìë´ë¥¼, ì¤ë¥ë©´ ìë¬ ë©ìì§ë¥¼ ì림ì¼ë¡ íìíë 컨í¸ë¡¤ë¬ 10 */ 11export default class extends Controller { 12 static values = { 13 url: String, 14 }; 15 16 async download(event) { 17 event.preventDefault(); 18 19 try { 20 const response = await fetch(this.urlValue, { method: 'HEAD' }); 21 22 if (response.status === 200) { 23 this.triggerDownload(); 24 } else if (response.status === 202) { 25 alert('ì´ë¯¸ì§ë¥¼ ì¤ë¹ ì¤ì ëë¤. ì ì í ë¤ì ìëí´ì£¼ì¸ì.'); 26 } else { 27 alert('ë¤ì´ë¡ë ì¤ ì¤ë¥ê° ë°ìíìµëë¤.'); 28 } 29 } catch (error) { 30 alert('ìë² ìì² ì¤ ë¬¸ì ê° ë°ìíìµëë¤.'); 31 console.error(error); 32 } 33 } 34 35 triggerDownload() { 36 const link = document.createElement('a'); 37 link.href = this.urlValue; 38 link.download = ''; 39 document.body.appendChild(link); 40 link.click(); 41 link.remove(); 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.