On 11/20/2015 03:17 AM, [email protected] wrote:
I'm a bit afraid of getting this mingled with real back-end and ending up with back-end 
that resolves localization strings because they need them for notifications but then, 
slowly expands to store localized strings for its front-end as well, so I'd love to see 
this back-end "front-end" code that sends notifications and alarms somehow 
isolated, but unless there's other reason to do that, we'll have to just be mindful. :)

A thing we've been doing in the email app conversations branch (which uses require.js-style AMD modules) is to have the back-end require() modules provided by the front-end. For example, the back-end does require('app_logic/conv_churn') to get the front-end-provided helper method that decides what (extra) information goes in the conversation summary object.

And this is what I plan to do for the periodic sync implementation on the conversations branch. The front-end gets to decide what it wants the notifications to look like, so it provides the logic and the strings and formats them.

But this is where we get into a terminology problem. What would be desired is for that front-end provided logic to be running in the back-end's Worker/SharedWorker/ServiceWorker. So it is front-end logic, but in a back-end context, in a way. And it looks like all the code in https://github.com/mozilla-b2g/gaia/blob/master/shared/js/intl/ is assuming that it's operating in a Window, not a *Worker. (Or maybe that's misleading and a side-effect of an overzealous transpiler/bundler?)

So I guess my question is: Is it currently possible or eventually planned to allow the l20n.js code to run in a worker context?

Andrew

PS: Relatedly, after looking at that directory: It is possible to put a README.md in gaia/shared/js/intl that explains that the code is transpiled from https://github.com/l20n/l20n.js or wherever it comes from? That's likely to save intrepid explorers a lot of headaches!
_______________________________________________
dev-fxos mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-fxos

Reply via email to