markmap-common
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -1,2 +0,2 @@ | ||
/*! markmap-common v0.1.1 | MIT License */ | ||
/*! markmap-common v0.1.2 | MIT License */ | ||
import _extends from '@babel/runtime/helpers/esm/extends'; | ||
@@ -239,6 +239,10 @@ | ||
return new Promise((resolve, reject) => { | ||
var _item$data; | ||
document.head.append(createElement('script', _extends({}, item.data, { | ||
onload: resolve, | ||
onerror: reject | ||
}))); | ||
}))); // Run inline script synchronously | ||
if (!((_item$data = item.data) != null && _item$data.src)) resolve(); | ||
}); | ||
@@ -269,3 +273,7 @@ } | ||
async function loadJS(items, context) { | ||
const needPreload = items.filter(item => item.type === 'script'); | ||
const needPreload = items.filter(item => { | ||
var _item$data2; | ||
return item.type === 'script' && ((_item$data2 = item.data) == null ? void 0 : _item$data2.src); | ||
}); | ||
if (needPreload.length > 1) needPreload.forEach(item => memoizedPreloadJS(item.data.src)); | ||
@@ -272,0 +280,0 @@ context = _extends({ |
@@ -1,2 +0,2 @@ | ||
/*! markmap-common v0.1.1 | MIT License */ | ||
/*! markmap-common v0.1.2 | MIT License */ | ||
'use strict'; | ||
@@ -247,6 +247,10 @@ | ||
return new Promise((resolve, reject) => { | ||
var _item$data; | ||
document.head.append(createElement('script', _extends__default({}, item.data, { | ||
onload: resolve, | ||
onerror: reject | ||
}))); | ||
}))); // Run inline script synchronously | ||
if (!((_item$data = item.data) != null && _item$data.src)) resolve(); | ||
}); | ||
@@ -277,3 +281,7 @@ } | ||
async function loadJS(items, context) { | ||
const needPreload = items.filter(item => item.type === 'script'); | ||
const needPreload = items.filter(item => { | ||
var _item$data2; | ||
return item.type === 'script' && ((_item$data2 = item.data) == null ? void 0 : _item$data2.src); | ||
}); | ||
if (needPreload.length > 1) needPreload.forEach(item => memoizedPreloadJS(item.data.src)); | ||
@@ -280,0 +288,0 @@ context = _extends__default({ |
{ | ||
"name": "markmap-common", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -31,3 +31,3 @@ "author": "", | ||
}, | ||
"gitHead": "d02c253a0cff97b604f96ffaec294e8da941c84b" | ||
"gitHead": "ba28b32d3697c1495bfede73910f589937fa63e4" | ||
} |
19659
622