Commit d4ba20b58c01dea031c4dbd86e4a99d066ca1c28
move buildImports to be internal
wanderer committed on 11/22/2016, 2:35:31 AMParent: 51739ba9fc171bb7d0f5e1bfee7b9021587cdede
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -12,20 +12,20 @@ | ||
12 | 12 | // if code is bound to this kernel then create the interfaceAPI and the |
13 | 13 | // imports |
14 | 14 | if (opts.code) { |
15 | 15 | this.interfaceAPI = new InterfaceAPI(opts.code) |
16 | - this.imports = this.buildImports(opts.interfaces) | |
16 | + this.imports = buildImports(this.interfaceAPI, opts.interfaces) | |
17 | 17 | } |
18 | - } | |
19 | 18 | |
20 | - /** | |
21 | - * Builds a import map with an array of given interfaces | |
22 | - */ | |
23 | - buildImports (interfaces = [Interface]) { | |
24 | - return interfaces.reduce((obj, Interface) => { | |
25 | - obj[Interface.name] = new Interface(this.interfaceAPI).exports | |
26 | - return obj | |
27 | - }, {}) | |
19 | + /** | |
20 | + * Builds a import map with an array of given interfaces | |
21 | + */ | |
22 | + function buildImports (api, interfaces = [Interface]) { | |
23 | + return interfaces.reduce((obj, Interface) => { | |
24 | + obj[Interface.name] = new Interface(api).exports | |
25 | + return obj | |
26 | + }, {}) | |
27 | + } | |
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
31 | 31 | * run the kernels code with a given enviroment |
Built with git-ssb-web