Skip to content

Commit

Permalink
Defaults to Instant flipper in low-performance browsers, else Slider.
Browse files Browse the repository at this point in the history
You can always override this with your own logic by passing the
'flipper' option when instantiating the Reader.
  • Loading branch information
joseph committed Feb 9, 2012
1 parent 2c114b6 commit 928ce16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/compat/browser.js
Expand Up @@ -77,6 +77,17 @@ Monocle.Browser.iOSVersionBelow = function (strOrNum) {
}


// Some browser environments are too slow or too problematic for
// special animation effects.
//
// FIXME: These tests are too opinionated. Replace with more targeted tests.
//
Monocle.Browser.renders = {
eInk: Monocle.Browser.on.Kindle3,
slow: Monocle.Browser.on.Android || Monocle.Browser.on.Blackberry
}


// A helper class for sniffing CSS features and creating CSS rules
// appropriate to the current rendering engine.
//
Expand Down
2 changes: 1 addition & 1 deletion src/core/reader.js
Expand Up @@ -151,7 +151,7 @@ Monocle.Reader = function (node, bookData, options, onLoadCallback) {

function attachFlipper(flipperClass) {
if (!flipperClass) {
if (Monocle.Browser.on.Kindle3) {
if (Monocle.Browser.renders.eInk || Monocle.Browser.renders.slow) {
flipperClass = Monocle.Flippers.Instant;
} else {
flipperClass = Monocle.Flippers.Slider;
Expand Down

0 comments on commit 928ce16

Please sign in to comment.