You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

highlight.worker.js 371 B

123456789101112
  1. import {highlightBlock} from 'highlight.js';
  2. import {createWindow} from 'domino';
  3. self.addEventListener('message', ({data}) => {
  4. const window = createWindow();
  5. self.document = window.document;
  6. const {index, html} = data;
  7. document.body.innerHTML = html;
  8. highlightBlock(document.body.firstChild);
  9. self.postMessage({index, html: document.body.innerHTML});
  10. });