forked from Evernote/evernote-sdk-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.js
35 lines (31 loc) · 1.08 KB
/
base.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
32
33
34
35
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var evernote = {
console: console,
require: require,
Buffer: Buffer,
ArrayBuffer: ArrayBuffer,
DataView: DataView,
Uint8Array: Uint8Array,
Int8Array: Int8Array,
};
var filenames = ['./evernote-sdk-js/thrift/lib/thrift.js',
'./evernote-sdk-js/thrift/lib/thrift-binary.js',
'./evernote-sdk-js/generated/Types_types.js',
'./evernote-sdk-js/generated/Limits_types.js',
'./evernote-sdk-js/generated/Errors_types.js',
'./evernote-sdk-js/generated/NoteStore_types.js',
'./evernote-sdk-js/generated/UserStore_types.js',
'./evernote-sdk-js/generated/UserStore.js',
'./evernote-sdk-js/generated/NoteStore.js'
];
for (var i = 0; i < filenames.length; i++) {
var filename = path.resolve(path.dirname(module.filename), filenames[i]);
var filedata = fs.readFileSync(filename);
vm.runInNewContext(filedata, evernote);
}
evernote.Thrift.NodeBinaryHttpTransport = require(
'./evernote-sdk-js/thrift/lib/node/thrift-node-binary.js'
).NodeBinaryHttpTransport;
exports.Evernote = evernote;