should not use bind for map's callback.

map pass item index as 2nd arg, so bind is not appropriate for the
function which take 2nd arg.
This commit is contained in:
t9md
2017-07-25 03:49:18 +09:00
parent 0e503cd81f
commit d9828cc85e

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) ->
@@ -989,4 +989,4 @@ promisify = (callback) ->
try
Promise.resolve(callback())
catch error
Promise.reject(error)
Promise.reject(error)