🎨 Rename to ::onWillNeedMeasurements

This commit is contained in:
Antonio Scandurra
2015-09-17 16:34:57 +02:00
parent 2ad336c649
commit 8a0d029ad1
3 changed files with 7 additions and 7 deletions

View File

@@ -224,12 +224,12 @@ describe "TextEditorPresenter", ->
presenter = buildPresenter()
expectNoStateUpdate presenter, -> presenter.getState()
it "triggers ::onWillMeasure events before computing any state that needs measurement", ->
it "triggers ::onWillNeedMeasurements events before computing any state that needs measurement", ->
editor.setCursorBufferPosition([0, 0])
cursorLine = editor.tokenizedLineForScreenRow(0)
called = false
onWillMeasureSpy = (state) ->
onWillNeedMeasurementsSpy = (state) ->
called = true
expect(Object.keys(state.content.tiles).length).toBeGreaterThan(0)
for tile, tileState of state.content.tiles
@@ -245,7 +245,7 @@ describe "TextEditorPresenter", ->
presenter = buildPresenter(explicitHeight: 6, scrollTop: 0, lineHeight: 1, tileSize: 2)
presenter.onWillMeasure(onWillMeasureSpy)
presenter.onWillNeedMeasurements(onWillNeedMeasurementsSpy)
presenter.getState()
expect(called).toBe(true)

View File

@@ -83,7 +83,7 @@ class TextEditorComponent
@linesYardstick = new LinesYardstick(@editor, this)
@presenter.setLinesYardstick(@linesYardstick)
@presenter.onWillMeasure(@updateLinesComponentSync)
@presenter.onWillNeedMeasurements(@updateLinesComponentSync)
@horizontalScrollbarComponent = new ScrollbarComponent({orientation: 'horizontal', onScroll: @onHorizontalScroll})
@scrollViewNode.appendChild(@horizontalScrollbarComponent.getDomNode())

View File

@@ -44,8 +44,8 @@ class TextEditorPresenter
@disposables.dispose()
# Calls your `callback` while performing ::getState(), before computing any state that needs measurements.
onWillMeasure: (callback) ->
@emitter.on "will-measure", callback
onWillNeedMeasurements: (callback) ->
@emitter.on "will-need-measurements", callback
# Calls your `callback` when some changes in the model occurred and the current state has been updated.
onDidUpdateState: (callback) ->
@@ -82,7 +82,7 @@ class TextEditorPresenter
@updateLinesDecorations() if @shouldUpdateDecorations
@updateTilesState() if @shouldUpdateLinesState or @shouldUpdateLineNumbersState
@emitter.emit "will-measure", @state
@emitter.emit "will-need-measurements", @state
@updateCommonGutterState()
@updateHorizontalDimensions()