File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed
Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,18 @@ Copyright 2011-14 Newcastle University
2525 _globalThis . Numbas = { }
2626 }
2727
28+ // Polyfill for Promise.withResolvers. Remove once it's reached 95% compatibility.
29+ if ( ! Promise . withResolvers ) {
30+ Promise . withResolvers = function ( ) {
31+ const out = { } ;
32+ out . promise = new this ( ( resolve , reject ) => {
33+ out . resolve = resolve ;
34+ out . reject = reject ;
35+ } ) ;
36+ return out ;
37+ }
38+ }
39+
2840/** @namespace Numbas */
2941/** Extensions should add objects to this so they can be accessed */
3042Numbas . extensions = { } ;
Original file line number Diff line number Diff line change @@ -27,6 +27,18 @@ Copyright 2011-14 Newcastle University
2727 _globalThis.Numbas = {}
2828 }
2929
30+ // Polyfill for Promise.withResolvers. Remove once it's reached 95% compatibility.
31+ if(!Promise.withResolvers) {
32+ Promise.withResolvers = function() {
33+ const out = {};
34+ out.promise = new this((resolve, reject) => {
35+ out.resolve = resolve;
36+ out.reject = reject;
37+ });
38+ return out;
39+ }
40+ }
41+
3042/** @namespace Numbas */
3143/** Extensions should add objects to this so they can be accessed */
3244Numbas.extensions = {};
Original file line number Diff line number Diff line change @@ -28,6 +28,18 @@ Copyright 2011-14 Newcastle University
2828 _globalThis.Numbas = {}
2929 }
3030
31+ // Polyfill for Promise.withResolvers. Remove once it's reached 95% compatibility.
32+ if(!Promise.withResolvers) {
33+ Promise.withResolvers = function() {
34+ const out = {};
35+ out.promise = new this((resolve, reject) => {
36+ out.resolve = resolve;
37+ out.reject = reject;
38+ });
39+ return out;
40+ }
41+ }
42+
3143/** @namespace Numbas */
3244/** Extensions should add objects to this so they can be accessed */
3345Numbas.extensions = {};
You can’t perform that action at this time.
0 commit comments