Merge pull request #15082 from t9md/fix-dangerous-bind-in-pane.coffee

Should not use bind for map's callback in pane.coffee.
This commit is contained in:
Max Brunsfeld 2017-07-24 13:56:21 -07:00 committed by GitHub
commit 73fa8d00aa

View File

@ -637,7 +637,7 @@ class Pane
# Public: Destroy all items.
destroyItems: ->
Promise.all(
@getItems().map(@destroyItem.bind(this))
@getItems().map((item) => @destroyItem(item))
)
# Public: Destroy all items except for the active item.
@ -645,7 +645,7 @@ class Pane
Promise.all(
@getItems()
.filter((item) => item isnt @activeItem)
.map(@destroyItem.bind(this))
.map((item) => @destroyItem(item))
)
promptToSaveItem: (item, options={}) ->
@ -950,7 +950,7 @@ class Pane
# Returns a {Promise} that resolves once the pane is either closed, or the
# closing has been cancelled.
close: ->
Promise.all(@getItems().map(@promptToSaveItem.bind(this))).then (results) =>
Promise.all(@getItems().map((item) => @promptToSaveItem(item))).then (results) =>
@destroy() unless results.includes(false)
handleSaveError: (error, item) ->