-
Notifications
You must be signed in to change notification settings - Fork 1k
Providing missingTranslationHandler() same flexibility as useStorage() #45
Comments
|
For example? |
Example for what? :) |
It'd be great to get more details on what you've posted. |
Just brainstorming. 1. Instead of one single failure handler, it could be list of handlers. We can add another api or just extend this one to be optional adding (default replace just like before) this.missingTranslationHandler = function (functionHandler, noReplace) {
if (angular.isUndefined(noReplace) || !noReplace) {
if (angular.isUndefined(functionHandler)) {
return $missingTranslationHandlers[0];
}
$missingTranslationHandlers = [functionHandler];
} else {
if (!angular.isUndefined(functionHandler) && functionHandler === true) {
return $missingTranslationHandlers;
} else {
$missingTranslationHandlers.push(functionHandler);
}
}
// supporting
function fn() {}
equals([], missingTranslationHandler(true));
equals(undefined, missingTranslationHandler());
missingTranslationHandler(fn);
equals(fn, missingTranslationHandler());
equals([fn], missingTranslationHandler(true));
missingTranslationHandler(fn, true);
equals(fn, missingTranslationHandler());
equals([fn, fn], missingTranslationHandler(true)); * 2. Just like missingTranslationHandler, but for success.* Before: $rootScope.$broadcast('translationChangeSuccess'); After: $successTranslationChangeHandler(); (Ore even a list because we will actually relay on that broadcast). |
@PascalPrecht Gotcha. Renaming a project while commenting isn't supported by Github. No redirect, only an error ;) |
Oh no wait.. the mail link is broken. |
This is of course a pretty cool approach of handling several handlers for errors and success, but I'm not sure if this is currently really required. If you want to, you can go ahead and implement this in canary. Otherwise, I'd just implement something like |
Implemented this in f6ed3e3 Will merge it into master later today. Last chance to review! |
Landed in master. |
Missing translation handler should be injectable as well!
Default behavior should be changed. Currently I have to do something like this, to avoid logging:
The text was updated successfully, but these errors were encountered: