Comparing version 0.1.10 to 0.1.11
{ | ||
"name": "bigkoa", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -26,2 +26,4 @@ 'use strict' | ||
this.json = {} | ||
// 设置 gzip 压缩 | ||
@@ -113,9 +115,11 @@ this.gzip = !!options.gzip | ||
*/ | ||
writeDataToBrowser (text, isWriteImmediately) { | ||
if (!text) { | ||
throw new Error('Write empty data to Browser.') | ||
} | ||
writeDataToBrowser (pagelet) { | ||
const text = pagelet.view | ||
if (!text) return | ||
// 是否立即写入,如果不立即写入,放到this.cache里 | ||
if (!isWriteImmediately || this.modeInstance.isLayoutWriteImmediately === false) { | ||
if (!pagelet.isWriteImmediately || this.modeInstance.isLayoutWriteImmediately === false) { | ||
if (pagelet.domid) { | ||
this.json[pagelet.domid] = pagelet._payload | ||
} | ||
return this.cache.push(text) | ||
@@ -131,10 +135,2 @@ } | ||
this.res.write(text) | ||
// if (this.gzip) { | ||
// this.output.write(text, () => { | ||
// debug(`bigview gzip, text size is: ${text.length}`) | ||
// this.output.flush() | ||
// }) | ||
// } else { | ||
// this.res.write(text) | ||
// } | ||
} | ||
@@ -174,4 +170,4 @@ } | ||
// 不生效,某种模式下会有问题 | ||
this.emit('bigviewWrite', html, isWriteImmediately) | ||
this.emit('bigviewWrite', { view: html, isWriteImmediately }) | ||
} | ||
} |
@@ -273,4 +273,3 @@ 'use strict' | ||
if (this.done) { | ||
let err = new Error('bigview.done = true') | ||
return Promise.reject(err) | ||
return Promise.resolve() | ||
} | ||
@@ -277,0 +276,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
254820
3021