Commit a5067a64 by Adeel

Code: Caches result as soon as v8 returns.

Not fixes segfault bug, but brings clarity of intent.
parent df228056
...@@ -161,12 +161,13 @@ function getOptions(options) { ...@@ -161,12 +161,13 @@ function getOptions(options) {
}; };
options.success = function() { options.success = function() {
var stats = endStats(options.result.stats); var result = options.result;
var stats = endStats(result.stats);
if (success) { if (success) {
success({ success({
css: options.result.css, css: result.css,
map: options.result.sourceMap, map: result.sourceMap,
stats: stats stats: stats
}); });
} }
...@@ -231,12 +232,13 @@ module.exports.render = function(options) { ...@@ -231,12 +232,13 @@ module.exports.render = function(options) {
module.exports.renderSync = function(options) { module.exports.renderSync = function(options) {
options = getOptions(options); options = getOptions(options);
var result = options.data ? binding.renderSync(options) : binding.renderFileSync(options); var status = options.data ? binding.renderSync(options) : binding.renderFileSync(options);
var result = options.result;
if(result) { if(status) {
options.result.stats = endStats(options.result.stats); result.stats = endStats(result.stats);
return options.result; return result;
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment