Migrate to block comments

This commit is contained in:
Kevin Sawicki 2016-01-11 18:03:02 -08:00
parent 630cd091a0
commit 403870a27e
44 changed files with 538 additions and 437 deletions

View file

@ -7,14 +7,16 @@ class CallbacksRegistry
@callbacks = {}
add: (callback) ->
# The callback is already added.
### The callback is already added. ###
id = v8Util.getHiddenValue callback, 'callbackId'
return id if id?
id = ++@nextId
# Capture the location of the function and put it in the ID string,
# so that release errors can be tracked down easily.
###
Capture the location of the function and put it in the ID string,
so that release errors can be tracked down easily.
###
regexp = /at (.*)/gi
stackString = (new Error).stack

View file

@ -1,5 +1,5 @@
if process.platform is 'linux' and process.type is 'renderer'
# On Linux we could not access clipboard in renderer process.
### On Linux we could not access clipboard in renderer process. ###
module.exports = require('electron').remote.clipboard
else
module.exports = process.atomBinding 'clipboard'

View file

@ -10,7 +10,7 @@ class CrashReporter
start: (options={}) ->
{@productName, companyName, submitURL, autoSubmit, ignoreSystemCrashHandler, extra} = options
# Deprecated.
### Deprecated. ###
{deprecate} = electron
if options.submitUrl
submitURL ?= options.submitUrl

View file

@ -1,4 +1,4 @@
# Deprecate a method.
### Deprecate a method. ###
deprecate = (oldName, newName, fn) ->
warned = false
->
@ -7,7 +7,7 @@ deprecate = (oldName, newName, fn) ->
deprecate.warn oldName, newName
fn.apply this, arguments
# The method is renamed.
### The method is renamed. ###
deprecate.rename = (object, oldName, newName) ->
warned = false
newMethod = ->
@ -20,7 +20,7 @@ deprecate.rename = (object, oldName, newName) ->
else
object[oldName] = newMethod
# Forward the method to member.
### Forward the method to member. ###
deprecate.member = (object, method, member) ->
warned = false
object.prototype[method] = ->
@ -29,7 +29,7 @@ deprecate.member = (object, method, member) ->
deprecate.warn method, "#{member}.#{method}"
this[member][method].apply this[member], arguments
# Deprecate a property.
### Deprecate a property. ###
deprecate.property = (object, property, method) ->
Object.defineProperty object, property,
get: ->
@ -39,11 +39,12 @@ deprecate.property = (object, property, method) ->
deprecate.warn "#{property} property", "#{method} method"
this[method]()
# Deprecate an event.
### Deprecate an event. ###
deprecate.event = (emitter, oldName, newName, fn) ->
warned = false
emitter.on newName, (args...) ->
if @listenerCount(oldName) > 0 # there is listeners for old API.
### there is listeners for old API. ###
if @listenerCount(oldName) > 0
unless warned or process.noDeprecation
warned = true
deprecate.warn "'#{oldName}' event", "'#{newName}' event"
@ -52,11 +53,11 @@ deprecate.event = (emitter, oldName, newName, fn) ->
else
@emit oldName, args...
# Print deprecation warning.
### Print deprecation warning. ###
deprecate.warn = (oldName, newName) ->
deprecate.log "#{oldName} is deprecated. Use #{newName} instead."
# Print deprecation message.
### Print deprecation message. ###
deprecate.log = (message) ->
if process.throwDeprecation
throw new Error(message)

View file

@ -1,16 +1,16 @@
# Do not expose the internal modules to `require`.
### Do not expose the internal modules to `require`. ###
exports.hideInternalModules = ->
{globalPaths} = require 'module'
if globalPaths.length is 3
# Remove the "common/api/lib" and "browser-or-renderer/api/lib".
### Remove the "common/api/lib" and "browser-or-renderer/api/lib". ###
globalPaths.splice 0, 2
# Attaches properties to |exports|.
### Attaches properties to |exports|. ###
exports.defineProperties = (exports) ->
Object.defineProperties exports,
# Common modules, please sort with alphabet order.
### Common modules, please sort with alphabet order. ###
clipboard:
# Must be enumerable, otherwise it woulde be invisible to remote module.
### Must be enumerable, otherwise it woulde be invisible to remote module. ###
enumerable: true
get: -> require '../clipboard'
crashReporter:
@ -22,7 +22,7 @@ exports.defineProperties = (exports) ->
shell:
enumerable: true
get: -> require '../shell'
# The internal modules, invisible unless you know their names.
### The internal modules, invisible unless you know their names. ###
CallbacksRegistry:
get: -> require '../callbacks-registry'
deprecate:

View file

@ -1,7 +1,7 @@
{deprecate} = require 'electron'
nativeImage = process.atomBinding 'native_image'
# Deprecated.
### Deprecated. ###
deprecate.rename nativeImage, 'createFromDataUrl', 'createFromDataURL'
module.exports = nativeImage