1function _assert_this_initialized(self) { 2 if (self === void 0) { 3 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4 } 5 return self; 6} 7function _class_call_check(instance, Constructor) { 8 if (!(instance instanceof Constructor)) { 9 throw new TypeError("Cannot call a class as a function"); 10 } 11} 12function _defineProperties(target, props) { 13 for(var i = 0; i < props.length; i++){ 14 var descriptor = props[i]; 15 descriptor.enumerable = descriptor.enumerable || false; 16 descriptor.configurable = true; 17 if ("value" in descriptor) descriptor.writable = true; 18 Object.defineProperty(target, descriptor.key, descriptor); 19 } 20} 21function _create_class(Constructor, protoProps, staticProps) { 22 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 23 if (staticProps) _defineProperties(Constructor, staticProps); 24 return Constructor; 25} 26function _define_property(obj, key, value) { 27 if (key in obj) { 28 Object.defineProperty(obj, key, { 29 value: value, 30 enumerable: true, 31 configurable: true, 32 writable: true 33 }); 34 } else { 35 obj[key] = value; 36 } 37 return obj; 38} 39function _get_prototype_of(o) { 40 _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) { 41 return o.__proto__ || Object.getPrototypeOf(o); 42 }; 43 return _get_prototype_of(o); 44} 45function _inherits(subClass, superClass) { 46 if (typeof superClass !== "function" && superClass !== null) { 47 throw new TypeError("Super expression must either be null or a function"); 48 } 49 subClass.prototype = Object.create(superClass && superClass.prototype, { 50 constructor: { 51 value: subClass, 52 writable: true, 53 configurable: true 54 } 55 }); 56 if (superClass) _set_prototype_of(subClass, superClass); 57} 58function _possible_constructor_return(self, call) { 59 if (call && (_type_of(call) === "object" || typeof call === "function")) { 60 return call; 61 } 62 return _assert_this_initialized(self); 63} 64function _set_prototype_of(o, p) { 65 _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) { 66 o.__proto__ = p; 67 return o; 68 }; 69 return _set_prototype_of(o, p); 70} 71function _type_of(obj) { 72 "@swc/helpers - typeof"; 73 return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; 74} 75function _is_native_reflect_construct() { 76 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 77 if (Reflect.construct.sham) return false; 78 if (typeof Proxy === "function") return true; 79 try { 80 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); 81 return true; 82 } catch (e) { 83 return false; 84 } 85} 86function _create_super(Derived) { 87 var hasNativeReflectConstruct = _is_native_reflect_construct(); 88 return function _createSuperInternal() { 89 var Super = _get_prototype_of(Derived), result; 90 if (hasNativeReflectConstruct) { 91 var NewTarget = _get_prototype_of(this).constructor; 92 result = Reflect.construct(Super, arguments, NewTarget); 93 } else { 94 result = Super.apply(this, arguments); 95 } 96 return _possible_constructor_return(this, result); 97 }; 98} 99import { Controller } from "@hotwired/stimulus"; 100var _class = /*#__PURE__*/ function(Controller) { 101 "use strict"; 102 _inherits(_class, Controller); 103 var _super = _create_super(_class); 104 function _class() { 105 _class_call_check(this, _class); 106 var _this; 107 _this = _super.apply(this, arguments); 108 _define_property(_assert_this_initialized(_this), "timer", void 0); 109 return _this; 110 } 111 _create_class(_class, [ 112 { 113 key: "connect", 114 value: function connect() { 115 this.schedule(); 116 } 117 }, 118 { 119 key: "schedule", 120 value: function schedule() { 121 var _this = this; 122 /* Floor rather than trust: a mis-typed value of 0 or 50 would turn a 123 * status panel into a request loop against the panel's own worker. */ var delay
123= Math.max(2000, this.intervalValue); 124 this.timer = setTimeout(function() { 125 /* A hidden tab re-arms instead of reloading. Not `return` â that 126 * would end the cycle, and the tab would show a frozen page 127 * whenever it came back. */ if (document.visibilityState !== "visible") { 128 _this.schedule(); 129 return; 130 } 131 window.location.reload(); 132 }, delay); 133 } 134 }, 135 { 136 key: "disconnect", 137 value: function disconnect() { 138 if (this.timer !== undefined) { 139 clearTimeout(this.timer); 140 this.timer = undefined; 141 } 142 } 143 } 144 ]); 145 return _class; 146}(Controller); 147_define_property(_class, "values", { 148 interval: { 149 type: Number, 150 default: 5000 151 } 152}); 153/** 154 * Reload Controller 155 * 156 * Reloads the page on an interval, for a screen showing something a *worker* 157 * is changing. Without it a reader sits on "Pending" until they reload on a 158 * hunch â the browser has no way to learn that a queue moved. 159 * 160 * Controller identifier: reload 161 * 162 * Usage: 163 * <div data-controller="reload" data-reload-interval-value="5000"> 164 * 165 * Only render the attribute while the thing is actually in progress: the 166 * timer stops when the element leaves the DOM, so "still in progress" is 167 * expressed by the server continuing to emit it, not by any state kept here. 168 * 169 * Deliberately a full navigation rather than a fetch-and-patch. What changes 170 * during an upgrade is a status badge, a message block and a set of buttons 171 * that must disappear â enough of the page that diffing it would be more 172 * moving parts than reloading it, at one request every few seconds. 173 */ export { _class as default };
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.