A service provider abstraction in JS