21 lines
639 B
JavaScript
21 lines
639 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.decodeGlobal = decodeGlobal;
|
|
const decodeConfig_1 = require("./decodeConfig");
|
|
/**
|
|
Decode changes from a JS API to a output object.
|
|
Only the configuration can be edited by plugin's hooks
|
|
|
|
@param {Output} output
|
|
@param {Object} result: result from API
|
|
@return {Output}
|
|
*/
|
|
function decodeGlobal(output, result) {
|
|
let book = output.getBook();
|
|
let config = book.getConfig();
|
|
// Update config
|
|
config = (0, decodeConfig_1.decodeConfig)(config, result.config);
|
|
book = book.set("config", config);
|
|
return output.set("book", book);
|
|
}
|