Closed pencilcheck closed 9 years ago
The tricky piece about this is the fact that each fa-app
really encapsulates a Context
, not the Engine
. Thus, setting Engine
options in the Context
s is unclean design at best, and counter-intuitive or unpredictable at worst. With this proposed solution, consider the case where you have two fa-app
s in your application and you set fpsCap
in the options on one of them. Although you would expect it to affect only one of the fa-app
, a developer would be surprised to find that the fpsCap
is set on all Context
s because it's an Engine-level config option that affects all existing Context
s .
Rather than this approach of setting Engine
options via individual Context
s (you'll note Context
itself doesn't have any options; there is no .setOptions
on Context
, and its constructor argument is a DOM element, not an options hash,) I would recommend using a run block to configure the Engine
at app bootstrap time. Something like:
myModule.run(function($famous){
var Engine = $famous['famous/core/Engine'];
var engineOptions = {
appMode: false
};
Engine.setOptions(engineOptions);
});
We really appreciate the time and effort you took to make this contribution, but for the outlined reasons we will not be merging this PR at this time.
I see. If that's the case, that makes more sense to do that in run block. Is it possible to update the README with this information? Because I believe a lot more users are using famous as an extra animation framework with another UI framework (e.g. hybrid mobile development like ionic). Disable app mode would be desirable.
fa-options will be too late to set options when createContext is called, for instance, app-mode if not disabled before calling createContext will attach a listener which will disable webapp scrolling.
Haven't thought of a better way to do so, but this is good for now.