Skip to content

Commit

Permalink
fix ie11
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Feb 14, 2019
1 parent ab42f86 commit 9e2c72f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/demo/demo.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* globals marked, unfetch, ES6Promise */

var useWorker = !!window.Worker;
if (!window.Promise) {
window.Promise = ES6Promise;
useWorker = false;
}
if (!window.fetch) {
window.fetch = unfetch;
useWorker = false;
}

onunhandledrejection = function (e) {
Expand Down Expand Up @@ -145,7 +148,7 @@ $clearElem.addEventListener('click', function () {
}, false);

function setDefaultOptions() {
if (window.Worker) {
if (useWorker) {
messageWorker({
task: 'defaults',
version: markedVersions[$markedVerElem.value]}
Expand Down Expand Up @@ -227,7 +230,7 @@ function updateLink() {
}

function updateVersion() {
if (window.Worker) {
if (useWorker) {
handleInput();
return Promise.resolve();
}
Expand All @@ -254,7 +257,7 @@ function updateVersion() {
var delayTime = 1;
var checkChangeTimeout = null;
function checkForChanges() {
if (inputDirty && (typeof marked !== 'undefined' || window.Worker)) {
if (inputDirty && (typeof marked !== 'undefined' || (useWorker))) {
inputDirty = false;

updateLink();
Expand All @@ -274,7 +277,7 @@ function checkForChanges() {
var hash = version + markdown + optionsString;
if (lastInput !== hash) {
lastInput = hash;
if (window.Worker) {
if (useWorker) {
delayTime = 100;
messageWorker({
task: 'parse',
Expand Down

0 comments on commit 9e2c72f

Please sign in to comment.