-
Notifications
You must be signed in to change notification settings - Fork 170
/
hummus.js
31 lines (26 loc) · 1 KB
/
hummus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var fs = require('fs');
var path = require('path');
var pregyp = require('@mapbox/node-pre-gyp');
var binding_path = pregyp.find(path.resolve(path.join(__dirname,'./package.json')));
var hummus = module.exports = require(binding_path);
var EventEmitter = require('events').EventEmitter;
/*
addons to PDFWriter prototype for events listening
*/
hummus.PDFWriter.prototype.getEvents = function() {
if(!this.events)
this.events = new EventEmitter();
return this.events;
}
hummus.PDFWriter.prototype.triggerDocumentExtensionEvent = function(eventName,eventParams) {
eventParams.writer = this;
this.getEvents().emit(eventName,eventParams);
}
/*
addon class for simple node wrappers
*/
hummus.PDFStreamForResponse = require('./PDFStreamForResponse');
hummus.PDFWStreamForFile = require('./PDFWStreamForFile');
hummus.PDFRStreamForFile = require('./PDFRStreamForFile');
hummus.PDFRStreamForBuffer = require('./PDFRStreamForBuffer');
hummus.PDFWStreamForBuffer = require('./PDFWStreamForBuffer');