electron/atom/common/api/lib/exports/electron.coffee

30 lines
1,021 B
CoffeeScript
Raw Normal View History

2016-01-12 02:03:02 +00:00
### Do not expose the internal modules to `require`. ###
2015-11-12 13:46:03 +00:00
exports.hideInternalModules = ->
{globalPaths} = require 'module'
if globalPaths.length is 3
2016-01-12 02:03:02 +00:00
### Remove the "common/api/lib" and "browser-or-renderer/api/lib". ###
2015-11-12 13:46:03 +00:00
globalPaths.splice 0, 2
2016-01-12 02:03:02 +00:00
### Attaches properties to |exports|. ###
2015-12-17 14:03:16 +00:00
exports.defineProperties = (exports) ->
Object.defineProperties exports,
2016-01-12 02:03:02 +00:00
### Common modules, please sort with alphabet order. ###
2015-12-17 14:03:16 +00:00
clipboard:
2016-01-12 02:03:02 +00:00
### Must be enumerable, otherwise it woulde be invisible to remote module. ###
2015-12-17 14:03:16 +00:00
enumerable: true
get: -> require '../clipboard'
crashReporter:
enumerable: true
get: -> require '../crash-reporter'
nativeImage:
enumerable: true
get: -> require '../native-image'
shell:
enumerable: true
get: -> require '../shell'
2016-01-12 02:03:02 +00:00
### The internal modules, invisible unless you know their names. ###
2015-12-17 14:03:16 +00:00
CallbacksRegistry:
get: -> require '../callbacks-registry'
deprecate:
get: -> require '../deprecate'