OcttKB/Wiki-OcttKB/tiddlers/System/$__OcttKB_Polyfills.js

17 lines
358 B
JavaScript
Raw Normal View History

2023-02-28 12:07:24 +01:00
/*\
Load our custom polyfills, for old browsers support.
\*/
exports.startup = function() {
try {
// https://stackoverflow.com/a/63958411
String.prototype.replaceAllTxt = function replaceAll(search, replace) {
return this.split(search).join(replace);
};
} catch(e) {
const Str = `${e.stack.split('\n')[0]}: ${e}`
console.log(Str);
return Str;
};
};