Re: [whatwg] [Notifications] Constructor should not have side effects

On Tue, 29 Jan 2013, Ryosuke Niwa wrote:
> > 
> > It also lets you create clean abstractions and layers so one library 
> > may create the notification, but another one may eventually show it.
> 
> This seems like a valid concern. Do existing libraries do this with XHR 
> and other objects that separate primary actions from instantiations?

This is easy to do. Just return a function that creates the notification, 
instead of returning a non-shown notification object.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 29 January 2013 20:13:24 UTC