PageSourceSearch

https://www.silivriden.com/build/js/swal-lazy.js?v=2286

js silivriden.com collected 2026-09-27 08:37:54 UTC 3,455 bytes, 94 lines download raw bytes

1/*!
2 * SweetAlert2 Lazy-Load Stub
3 *
4 * Critical path'ten Swal'i cikartir — kutuphane sadece ilk kullanimda
5 * (Swal.fire cagrildiginda) arka planda yuklenir. PageSpeed skoru
6 * artar, UX ayni kalir.
7 *
8 * Tum mevcut Swal API calls olduklari gibi calisir:
9 *   Swal.fire({...}) — Promise doner
10 *   Swal.close(), Swal.showLoading(), Swal.showValidationMessage(), Swal.update()
11 *   Swal.DismissReason.cancel
12 *
13 * Bir kez yuklendikten sonra window.Swal gercek kutuphaneye isaret eder.
14 */
15(function () {
16    'use strict';
17
18    var CSS_URL = '/build/libs/sweetalert2/sweetalert2.min.css';
19    var JS_URL = '/build/libs/sweetalert2/sweetalert2.min.js';
20
21    var loadPromise = null;
22
23    function loadSwal() {
24        if (loadPromise) return loadPromise;
25
26        loadPromise = new Promise(function (resolve, reject) {
27            // CSS yukle (async, sonucunu beklemiyoruz)
28            var link = document.createElement('link');
29            link.rel = 'stylesheet';
30            link.href = CSS_URL;
31            document.head.appendChild(link);
32
33            // JS yukle — onload'da gercek Swal stub'u override eder
34            var script = document.createElement('script');
35            script.src = JS_URL;
36            script.onload = function () { resolve(window.Swal); };
37            script.onerror = function () {
38                loadPromise = null;
39                reject(new Error('SweetAlert2 yuklenemedi'));
40            };
41            document.head.appendChild(script);
42        });
43
44        return loadPromise;
45    }
46
47    // Stub — gercek Swal yuklenene kadar butun cagrilari yonlendirir.
48    // Yuklendiginde window.Swal override olur (gercek kutuphane kendini register eder).
49    window.Swal = {
50        fire: function () {
51            var args = Array.prototype.slice.call(arguments);
52            return loadSwal().then(function (RealSwal) {
53                return RealSwal.fire.apply(RealSwal, args);
54            });
55        },
56        close: function () {
57            var args = Array.prototype.slice.call(arguments);
58            return loadSwal().then(function (RealSwal) {
59                return RealSwal.close.apply(RealSwal, args);
60            });
61        },
62        showLoading: function () {
63            var args = Array.prototype.slice.call(arguments);
64            return loadSwal().then(function (RealSwal) {
65                return RealSwal.showLoading.apply(RealSwal, args);
66            });
67        },
68        showValidationMessage: function () {
69            var args = Array.prototype.slice.call(arguments);
70            return loadSwal().then(function (RealSwal) {
71                return RealSwal.showValidationMessage.apply(RealSwal, args);
72            });
73        },
74        update: function () {
75            var args = Array.prototype.slice.call(arguments);
76            return loadSwal().then(function (RealSwal) {
77                return RealSwal.update.apply(RealSwal, args);
78            });
79        },
80        isVisible: function () {
81            // Stub asamasinda gorunur olamaz
82            if (!loadPromise) return false;
83            return window.Swal !== this && typeof window.Swal.isVisible === 'function' && window.Swal.isVisible();
84        },
85        // Senkron erisilen sabit — gercek Swal'i uyumlu deger ile taklit eder
86        DismissReason: {
87            cancel: 'cancel',
88            close: 'close',
89            backdrop: 'backdrop',
90            timer: 'timer',
91            esc: 'esc'
92        }
93    };
94})();

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.