mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
d54bcc4aa9
Move overleaf-editor-core code to ES6 classes GitOrigin-RevId: f9b50579aec0cef9d9e6aefcfcb3e380fae4b6f4
33 lines
589 B
JavaScript
33 lines
589 B
JavaScript
'use strict'
|
|
|
|
const assert = require('check-types').assert
|
|
const Chunk = require('./chunk')
|
|
|
|
/**
|
|
* The ChunkResponse allows for additional data to be sent back with the chunk
|
|
* at present there are no extra data to send.
|
|
*/
|
|
class ChunkResponse {
|
|
constructor(chunk) {
|
|
assert.instance(chunk, Chunk)
|
|
this.chunk = chunk
|
|
}
|
|
|
|
toRaw() {
|
|
return {
|
|
chunk: this.chunk.toRaw(),
|
|
}
|
|
}
|
|
|
|
static fromRaw(raw) {
|
|
if (!raw) return null
|
|
|
|
return new ChunkResponse(Chunk.fromRaw(raw.chunk))
|
|
}
|
|
|
|
getChunk() {
|
|
return this.chunk
|
|
}
|
|
}
|
|
|
|
module.exports = ChunkResponse
|