Skip to content

Commit b39769a

Browse files
Merge pull request #40 from electron/prefix-process
Prefix things correctly in the process module
2 parents b7b2b09 + cb8ffb4 commit b39769a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

lib/module-declaration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const generateModuleDeclaration = (module, index, API) => {
129129
}
130130
}
131131

132-
const paramString = utils.genMethodString(paramInterfaces, module, moduleMethod, moduleMethod.parameters, moduleMethod.returns, false)
132+
const paramString = utils.genMethodString(paramInterfaces, module, moduleMethod, moduleMethod.parameters, moduleMethod.returns, false, module.name === 'process' ? 'Electron.' : '')
133133

134134
moduleAPI.push(`${prefix}${moduleMethod.name}(${paramString})${moduleMethod.name === 'constructor' ? '' : `: ${utils.typify(returnType)}`};`)
135135
}

lib/utils.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ const isOptional = (param) => {
139139
return true
140140
}
141141

142-
const genMethodString = (paramInterfaces, module, moduleMethod, parameters, returns, includeType) => {
142+
const genMethodString = (paramInterfaces, module, moduleMethod, parameters, returns, includeType, paramTypePrefix) => {
143+
paramTypePrefix = paramTypePrefix || ''
143144
if (typeof includeType === 'undefined') {
144145
includeType = true
145146
}
@@ -175,6 +176,10 @@ const genMethodString = (paramInterfaces, module, moduleMethod, parameters, retu
175176
type = `${typify(paramType)}${paramify(param.name).startsWith('...') && !typify(paramType).endsWith('[]') ? '[]' : ''}`
176177
}
177178
179+
if (param.type !== 'Function' && type.substr(0, 1).toLowerCase() !== type.substr(0, 1)) {
180+
type = paramTypePrefix + type
181+
}
182+
178183
return `${name}${optional}: ${type}`
179184
}).join(', ')}${includeType ? `) => ${returns ? typify(returns) : 'void'}` : ''}`
180185
}

vendor/fetch-docs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const mkdirp = require('mkdirp').sync
77
const os = require('os')
88

99
const downloadPath = path.join(os.tmpdir(), 'electron-api-tmp')
10-
const ELECTRON_COMMIT = 'a686237d9bc47e56498d7aa3d9f8a21f9ca2a8e9'
10+
const ELECTRON_COMMIT = '6ca7787f13ec06d092aba241588b8151db7266ec'
1111

1212
rm(downloadPath)
1313

0 commit comments

Comments
 (0)