mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
💄 Move extend calls to top of class
This commit is contained in:
@@ -23,6 +23,8 @@ userStoragePath = path.join(configDirPath, "storage")
|
||||
# user's configuration file.
|
||||
module.exports =
|
||||
class Config
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
configDirPath: configDirPath
|
||||
themeDirPaths: [userThemesDirPath, bundledThemesDirPath]
|
||||
bundledPackageDirPaths: [nodeModulesDirPath]
|
||||
@@ -210,5 +212,3 @@ class Config
|
||||
|
||||
save: ->
|
||||
CSON.writeFileSync(@configFilePath, @settings)
|
||||
|
||||
_.extend Config.prototype, EventEmitter
|
||||
|
||||
@@ -7,6 +7,8 @@ _ = require 'underscore'
|
||||
# Cursors have some metadata attached in the form of a {BufferMarker}.
|
||||
module.exports =
|
||||
class Cursor
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
screenPosition: null
|
||||
bufferPosition: null
|
||||
goalColumn: null
|
||||
@@ -441,5 +443,3 @@ class Cursor
|
||||
# Returns an {Array} of {String}s.
|
||||
getScopes: ->
|
||||
@editSession.scopesForBufferPosition(@getBufferPosition())
|
||||
|
||||
_.extend Cursor.prototype, EventEmitter
|
||||
|
||||
@@ -11,6 +11,8 @@ EventEmitter = require 'event-emitter'
|
||||
# Directories contain an array of {File}s.
|
||||
module.exports =
|
||||
class Directory
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
path: null
|
||||
realPath: null
|
||||
|
||||
@@ -116,5 +118,3 @@ class Directory
|
||||
if @watchSubscription?
|
||||
@watchSubscription.close()
|
||||
@watchSubscription = null
|
||||
|
||||
_.extend Directory.prototype, EventEmitter
|
||||
|
||||
@@ -5,6 +5,9 @@ Subscriber = require 'subscriber'
|
||||
|
||||
module.exports =
|
||||
class DisplayBufferMarker
|
||||
_.extend @prototype, EventEmitter
|
||||
_.extend @prototype, Subscriber
|
||||
|
||||
bufferMarkerSubscription: null
|
||||
oldHeadBufferPosition: null
|
||||
oldHeadScreenPosition: null
|
||||
@@ -213,6 +216,3 @@ class DisplayBufferMarker
|
||||
@oldTailBufferPosition = newTailBufferPosition
|
||||
@oldTailScreenPosition = newTailScreenPosition
|
||||
@wasValid = isValid
|
||||
|
||||
_.extend DisplayBufferMarker.prototype, EventEmitter
|
||||
_.extend DisplayBufferMarker.prototype, Subscriber
|
||||
|
||||
@@ -16,6 +16,9 @@ TextMateScopeSelector = require('first-mate').ScopeSelector
|
||||
# An `EditSession` manages the states between {Editor}s, {Buffer}s, and the project as a whole.
|
||||
module.exports =
|
||||
class EditSession
|
||||
_.extend @prototype, EventEmitter
|
||||
_.extend @prototype, Subscriber
|
||||
|
||||
@acceptsDocuments: true
|
||||
|
||||
registerDeserializer(this)
|
||||
@@ -1396,6 +1399,3 @@ class EditSession
|
||||
@displayBuffer.getDebugSnapshot()
|
||||
@displayBuffer.tokenizedBuffer.getDebugSnapshot()
|
||||
].join('\n\n')
|
||||
|
||||
_.extend(EditSession.prototype, EventEmitter)
|
||||
_.extend(EditSession.prototype, Subscriber)
|
||||
|
||||
@@ -12,6 +12,8 @@ _ = require 'underscore'
|
||||
# * {Directory}, which associcates the children of a directory as files
|
||||
module.exports =
|
||||
class File
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
path: null
|
||||
cachedContents: null
|
||||
|
||||
@@ -108,5 +110,3 @@ class File
|
||||
if @watchSubscription
|
||||
@watchSubscription.close()
|
||||
@watchSubscription = null
|
||||
|
||||
_.extend File.prototype, EventEmitter
|
||||
|
||||
@@ -9,6 +9,9 @@ Subscriber = require 'subscriber'
|
||||
|
||||
module.exports =
|
||||
class LanguageMode
|
||||
_.extend @prototype, EventEmitter
|
||||
_.extend @prototype, Subscriber
|
||||
|
||||
buffer: null
|
||||
grammar: null
|
||||
editSession: null
|
||||
@@ -296,6 +299,3 @@ class LanguageMode
|
||||
foldEndRegexForScopes: (scopes) ->
|
||||
if foldEndPattern = syntax.getProperty(scopes, 'editor.foldEndPattern')
|
||||
new OnigRegExp(foldEndPattern)
|
||||
|
||||
_.extend LanguageMode.prototype, EventEmitter
|
||||
_.extend LanguageMode.prototype, Subscriber
|
||||
|
||||
@@ -5,6 +5,8 @@ _ = require 'underscore'
|
||||
### Internal ###
|
||||
module.exports =
|
||||
class NullGrammar
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
name: 'Null Grammar'
|
||||
scopeName: 'text.plain.null-grammar'
|
||||
|
||||
@@ -20,5 +22,3 @@ class NullGrammar
|
||||
tokens
|
||||
|
||||
grammarUpdated: -> # noop
|
||||
|
||||
_.extend NullGrammar.prototype, EventEmitter
|
||||
|
||||
@@ -19,6 +19,8 @@ Git = require 'git'
|
||||
# of directories and files that you can operate on.
|
||||
module.exports =
|
||||
class Project
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
@acceptsDocuments: true
|
||||
@version: 1
|
||||
|
||||
@@ -359,5 +361,3 @@ class Project
|
||||
subscriber.subscribe this, 'buffer-created', (buffer) -> callback(buffer)
|
||||
else
|
||||
@on 'buffer-created', (buffer) -> callback(buffer)
|
||||
|
||||
_.extend Project.prototype, EventEmitter
|
||||
|
||||
@@ -5,6 +5,8 @@ _ = require 'underscore'
|
||||
# Public: Represents a selection in the {EditSession}.
|
||||
module.exports =
|
||||
class Selection
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
cursor: null
|
||||
marker: null
|
||||
editSession: null
|
||||
@@ -546,5 +548,3 @@ class Selection
|
||||
screenRangeChanged: ->
|
||||
screenRange = @getScreenRange()
|
||||
@trigger 'screen-range-changed', screenRange
|
||||
|
||||
_.extend Selection.prototype, EventEmitter
|
||||
|
||||
@@ -11,6 +11,8 @@ TextMateScopeSelector = require('first-mate').ScopeSelector
|
||||
|
||||
module.exports =
|
||||
class Syntax
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
registerDeserializer(this)
|
||||
|
||||
@deserialize: ({grammarOverridesByPath}) ->
|
||||
@@ -133,5 +135,3 @@ class Syntax
|
||||
|
||||
cssSelectorFromScopeSelector: (scopeSelector) ->
|
||||
new TextMateScopeSelector(scopeSelector).toCssSelector()
|
||||
|
||||
_.extend(Syntax.prototype, EventEmitter)
|
||||
|
||||
@@ -4,6 +4,8 @@ EventEmitter = require 'event-emitter'
|
||||
|
||||
module.exports =
|
||||
class Task
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
@once: (taskPath, args...) ->
|
||||
task = new Task(taskPath)
|
||||
task.one 'task:completed', -> task.terminate()
|
||||
@@ -56,5 +58,3 @@ class Task
|
||||
@childProcess = null
|
||||
|
||||
@off()
|
||||
|
||||
_.extend Task.prototype, EventEmitter
|
||||
|
||||
@@ -13,8 +13,8 @@ guid = require 'guid'
|
||||
# the case, as a `Buffer` could be an unsaved chunk of text.
|
||||
module.exports =
|
||||
class TextBuffer
|
||||
_.extend(@prototype, EventEmitter)
|
||||
_.extend(@prototype, Subscriber)
|
||||
_.extend @prototype, EventEmitter
|
||||
_.extend @prototype, Subscriber
|
||||
|
||||
@acceptsDocuments: true
|
||||
@version: 2
|
||||
|
||||
@@ -10,6 +10,9 @@ telepath = require 'telepath'
|
||||
|
||||
module.exports =
|
||||
class TokenizedBuffer
|
||||
_.extend @prototype, EventEmitter
|
||||
_.extend @prototype, Subscriber
|
||||
|
||||
grammar: null
|
||||
currentGrammarScore: null
|
||||
buffer: null
|
||||
@@ -323,6 +326,3 @@ class TokenizedBuffer
|
||||
for screenLine, row in @linesForScreenRows(0, @getLastRow())
|
||||
lines.push "#{row}: #{screenLine.text}"
|
||||
lines.join('\n')
|
||||
|
||||
_.extend(TokenizedBuffer.prototype, EventEmitter)
|
||||
_.extend(TokenizedBuffer.prototype, Subscriber)
|
||||
|
||||
@@ -7,6 +7,8 @@ fsUtils = require 'fs-utils'
|
||||
|
||||
module.exports =
|
||||
class WindowEventHandler
|
||||
_.extend @prototype, Subscriber
|
||||
|
||||
constructor: ->
|
||||
@subscribe ipc, 'command', (command, args...) ->
|
||||
$(window).trigger(command, args...)
|
||||
@@ -89,5 +91,3 @@ class WindowEventHandler
|
||||
previousElement = element
|
||||
|
||||
(previousElement ? highestElement).focus()
|
||||
|
||||
_.extend WindowEventHandler.prototype, Subscriber
|
||||
|
||||
Reference in New Issue
Block a user