Skip to content

Commit

Permalink
Merge pull request #778 from zeitgeist87/gh-pages
Browse files Browse the repository at this point in the history
Improve performance by doing more work in the worker
  • Loading branch information
Golmote committed Sep 24, 2015
2 parents 69ea994 + 09be99e commit 1316abc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ var _ = _self.Prism = {
var worker = new Worker(_.filename);

worker.onmessage = function(evt) {
env.highlightedCode = Token.stringify(JSON.parse(evt.data), language);
env.highlightedCode = evt.data;

_.hooks.run('before-insert', env);

Expand Down Expand Up @@ -398,7 +398,7 @@ if (!_self.document) {
code = message.code,
immediateClose = message.immediateClose;

_self.postMessage(JSON.stringify(_.util.encode(_.tokenize(code, _.languages[lang]))));
_self.postMessage(_.highlight(code, _.languages[lang], lang));
if (immediateClose) {
_self.close();
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-core.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ var _ = _self.Prism = {
var worker = new Worker(_.filename);

worker.onmessage = function(evt) {
env.highlightedCode = Token.stringify(JSON.parse(evt.data), language);
env.highlightedCode = evt.data;

_.hooks.run('before-insert', env);

Expand Down Expand Up @@ -403,7 +403,7 @@ if (!_self.document) {
code = message.code,
immediateClose = message.immediateClose;

_self.postMessage(JSON.stringify(_.util.encode(_.tokenize(code, _.languages[lang]))));
_self.postMessage(_.highlight(code, _.languages[lang], lang));
if (immediateClose) {
_self.close();
}
Expand Down

0 comments on commit 1316abc

Please sign in to comment.