luci-base: add ES6 Promise polyfill for IE < Edge
authorJo-Philipp Wich <jo@mein.io>
Sun, 6 Jan 2019 15:42:52 +0000 (16:42 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sun, 7 Jul 2019 13:25:49 +0000 (15:25 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/promis.min.js [new file with mode: 0644]
modules/luci-base/luasrc/view/header.htm

diff --git a/modules/luci-base/htdocs/luci-static/resources/promis.min.js b/modules/luci-base/htdocs/luci-static/resources/promis.min.js
new file mode 100644 (file)
index 0000000..ff71b69
--- /dev/null
@@ -0,0 +1,5 @@
+/* Licensed under the BSD license. Copyright 2014 - Bram Stein. All rights reserved.
+ * https://github.com/bramstein/promis */
+(function(){'use strict';var f,g=[];function l(a){g.push(a);1==g.length&&f()}function m(){for(;g.length;)g[0](),g.shift()}f=function(){setTimeout(m)};function n(a){this.a=p;this.b=void 0;this.f=[];var b=this;try{a(function(a){q(b,a)},function(a){r(b,a)})}catch(c){r(b,c)}}var p=2;function t(a){return new n(function(b,c){c(a)})}function u(a){return new n(function(b){b(a)})}function q(a,b){if(a.a==p){if(b==a)throw new TypeError;var c=!1;try{var d=b&&b.then;if(null!=b&&"object"==typeof b&&"function"==typeof d){d.call(b,function(b){c||q(a,b);c=!0},function(b){c||r(a,b);c=!0});return}}catch(e){c||r(a,e);return}a.a=0;a.b=b;v(a)}}
+function r(a,b){if(a.a==p){if(b==a)throw new TypeError;a.a=1;a.b=b;v(a)}}function v(a){l(function(){if(a.a!=p)for(;a.f.length;){var b=a.f.shift(),c=b[0],d=b[1],e=b[2],b=b[3];try{0==a.a?"function"==typeof c?e(c.call(void 0,a.b)):e(a.b):1==a.a&&("function"==typeof d?e(d.call(void 0,a.b)):b(a.b))}catch(h){b(h)}}})}n.prototype.g=function(a){return this.c(void 0,a)};n.prototype.c=function(a,b){var c=this;return new n(function(d,e){c.f.push([a,b,d,e]);v(c)})};
+function w(a){return new n(function(b,c){function d(c){return function(d){h[c]=d;e+=1;e==a.length&&b(h)}}var e=0,h=[];0==a.length&&b(h);for(var k=0;k<a.length;k+=1)u(a[k]).c(d(k),c)})}function x(a){return new n(function(b,c){for(var d=0;d<a.length;d+=1)u(a[d]).c(b,c)})};window.Promise||(window.Promise=n,window.Promise.resolve=u,window.Promise.reject=t,window.Promise.race=x,window.Promise.all=w,window.Promise.prototype.then=n.prototype.c,window.Promise.prototype["catch"]=n.prototype.g,window.Promise.prototype.finally=function(a){return this.c(a,a)});}());
index d68e39f9177cdfb99afefce17cc46f707771c42a..70839c5d826326ead647a804607b02b44e04ad18 100644 (file)
@@ -11,6 +11,7 @@
        end
 %>
 
+<script type="text/javascript" src="<%=resource%>/promis.min.js"></script>
 <script type="text/javascript" src="<%=resource%>/luci.js"></script>
 <script type="text/javascript">
        L = new LuCI(<%= luci.http.write_json({