Last active
March 28, 2016 21:07
-
-
Save emilong/7bfc0a507f5bdffa7048 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Factory | |
function createPdfGenerator(Content, PdfApi) { | |
return { | |
generate: function(contentId) { | |
const content = Content.find(contentId); | |
return PdfApi.render(content.format()); | |
} | |
}; | |
} | |
// Export a function that registers the service provider with the given container. | |
modules.export = function(bottle) { | |
bottle.service( | |
'service.PdfGenerator', // the name of the service we're providing | |
createPdfGenerator, // the factory to create the service instance | |
'model.Content', 'client.PdfApi' // the dependencies required to create the factory | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment