function getEntry(library,type,path) { if (!knownTypes.hasOwnProperty(type)) { throw new Error(log._("library.unknownType",{type: type})) } if (libraries.hasOwnProperty(library)) { return libraries[library].getEntry(type,path); } else { throw new Error(log._("library.unknownLibrary",{library: library})) } }
saveEntry:将传入的对象实例化,使用的序列化模块由传入参数决定
1 2 3 4 5 6 7 8 9 10 11 12 13 14
function saveEntry(library,type,path,meta,body) { if (!knownTypes.hasOwnProperty(type)) { throw new Error(log._("library.unknownType",{type: type})) } if (libraries.hasOwnProperty(library)) { if (libraries[library].saveEntry) { return libraries[library].saveEntry(type,path,meta,body); } else { throw new Error(log._("library.readOnly",{library: library})) } } else { throw new Error(log._("library.unknownLibrary",{library: library})) } }