Improving polyfill inclusion and fixing SVG issues
This commit is contained in:
1 parent
88863c5ece
commit
f5af70a218
6 files changed
+51
-102
No files matched your search
@@ -1,9 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import writeScript from './lib/writeScript';
|
||||
|
||||
// Fix SVG+USE issues
|
||||
writeScript('svg4everybody.min.js');
|
||||
Meteor.startup(() => {
|
||||
// Call the SVG polyfill
|
||||
window.svg4everybody();
|
||||
});
|
||||
@@ -1,6 +1,12 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import writeScript from './lib/writeScript';
|
||||
|
||||
// Check if browser is IE and add the polyfill scripts
|
||||
if (navigator && /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
|
||||
writeScript('typedarray.min.js');
|
||||
}
|
||||
Meteor.startup(() => {
|
||||
// Check if browser is IE and add the polyfill scripts
|
||||
if (navigator && /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
|
||||
writeScript('typedarray.min.js');
|
||||
|
||||
// Fix SVG+USE issues by calling the SVG polyfill
|
||||
writeScript('svg4everybody.min.js', () => window.svg4everybody());
|
||||
}
|
||||
});
|
||||
@@ -1,2 +1 @@
|
||||
import './all.js';
|
||||
import './ie.js';
|
||||
@@ -1,7 +1,14 @@
|
||||
/* jshint -W060 */
|
||||
import absoluteUrl from './absoluteUrl';
|
||||
|
||||
export default function(fileName) {
|
||||
const src = absoluteUrl(`/packages/ohif_polyfill/public/js/${fileName}`);
|
||||
document.write(`<script src="${src}"><\/script>`);
|
||||
export default function(fileName, callback) {
|
||||
const script = document.createElement('script');
|
||||
script.src = absoluteUrl(`/packages/ohif_polyfill/public/js/${fileName}`);
|
||||
script.onload = () => {
|
||||
if (typeof callback === 'function') {
|
||||
callback(script);
|
||||
}
|
||||
};
|
||||
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
Reference in new issue
Block a user