W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2013

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

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 29 Jan 2013 20:13:00 +0000 (UTC)
To: Ryosuke Niwa <rniwa@apple.com>
Message-ID: <Pine.LNX.4.64.1301292012230.6293@ps20323.dreamhostps.com>
Cc: WHATWG <whatwg@whatwg.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:12 GMT