Browse files

Insert, rather than push, new adapters

The old way of pushing adapters meant that you would have to forcibly
request any kind of provider other than the localStorage one with a
window-based fallback; you could not add other providers in order of
preference, for example, because if the code failed on the adapter
provided in options, it would just plain fail.  This change allows the
user to set up a preferred-order list, ending with localStorage and
  • Loading branch information...
cwilso committed Mar 26, 2012
1 parent f177bff commit 8d1bb64977505a406d1d3f43c32fb15a4d39fe47
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/Lawnchair.js
@@ -78,7 +78,8 @@ Lawnchair.adapter = function (id, obj) {
if (indexOf(implementing, i) === -1) throw 'Invalid adapter! Nonstandard method: ' + i
// if we made it this far the adapter interface is valid
- Lawnchair.adapters.push(obj)
+ // insert the new adapter as the preferred adapter
+ Lawnchair.adapters.splice(0,0,obj)
Lawnchair.plugins = []

0 comments on commit 8d1bb64

Please sign in to comment.