-
Notifications
You must be signed in to change notification settings - Fork 8
Initialization
kyleduo edited this page Mar 12, 2018
·
2 revisions
You have seen a simple initialization in previous chapter. This Chapter will introduce you some methods you need to know when initial Rabbits.
RabbitConfig contains some necessary params used by Rabbit when initialize. You can get a RabbitConfig instance by invoke RabbitConfig.get()
method. After you get an instance, you need to configure valid schemes and domains. Only those urls matching these schemes and domains can be parsed by Rabbits.
If you need support special schemes and domains, you can configure full url on a page. You can find the instruction on @Page() part.
- schemes(String…) configure valid schemes.
- domains(String…) configure valid domains.
- debug(boolean) configure whether printing debug logs.
Rabbit is a basic class of Rabbits. Both initialization and navigation start from Rabbit.
- init(RabbitConfig) initial Rabbit using RabbitConfig instance.
- addInterceptor(Interceptor) add an interceptor.
- addInterceptor(Interceptor, Rule) add an interceptor with rule. Only those actions match the rule would be intercepted.
- registerNavigator(int, Navigator) register a Navigator for a specific page type. Usually you need this method to support Fragment navigation.
- registerFallbackNavigator(Navigator) register fallback navigator. If Rabbits can’t find a target matching the url, this navigator will be invoked.
- get() return the singleton instance of Rabbit. Only call this method after initialization.
These are all the methods you need to know about the initialization.