HubSpot / messenger

Growl-style alerts and messages for your app. #hubspot-open-source
http://github.hubspot.com/messenger/
MIT License
4.02k stars 406 forks source link

successMessage, errorMessage, and progressMessage do not accept a function that returns an object. #83

Closed ardoramor closed 9 years ago

ardoramor commented 10 years ago

Documentation states that successMessage, errorMessage, and progressMessage are able to take a function that returns an message configuration object. However, from the code below, the return of the function clearly expects a string:

return n = a[e + "Message"], o.isFunction(n) ? n.call(g, e, t) : n

If the function, in this case n, returns an object, it is later on written into 'message' during success and error states.

geekjuice commented 9 years ago

I'm not entirely sure that is true. If you look at the non-uglified Coffeescript, it's a little clearer that code above invokes the function type + 'Message' where type is {'success', 'error', 'progress'}' if it's a function, otherwise just return the value oftype + 'Message'`. Trying to read uglified code can be misleading since its all mangled up. If you do happen to run into an real example where the above does not work, feel free to open a new issue with the examples and we'll be happy to help debug the issue.