mirror of
https://github.com/InsanusMokrassar/docs.git
synced 2026-01-04 04:19:07 +00:00
Compare commits
8 Commits
5981c587c4
...
3d5a1dade8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d5a1dade8 | ||
| a5ff5de5bd | |||
| 7e43dece5f | |||
| 66d4bdf5e6 | |||
| bfc7b98482 | |||
| 762ab04bfb | |||
| c9675ec31a | |||
| 470043d360 |
@@ -16,6 +16,8 @@ runtime of applications.
|
|||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
|
__[Here](https://insanusmokrassar.github.io/KrontabPredictor) you may find the builder for `Krontab` templates creation.__
|
||||||
|
|
||||||
There are several ways to configure and use this library:
|
There are several ways to configure and use this library:
|
||||||
|
|
||||||
* From some string
|
* From some string
|
||||||
|
|||||||
@@ -7,15 +7,17 @@ As has been said in the [setup](setup.md) section, this library contains next le
|
|||||||
|
|
||||||
| Weight (by order) | LogLevel name | JS | JVM Loggers | Android |
|
| Weight (by order) | LogLevel name | JS | JVM Loggers | Android |
|
||||||
| -: |:-------------:|:-------------:|:-------------:|:-------:|
|
| -: |:-------------:|:-------------:|:-------------:|:-------:|
|
||||||
| 0 | DEBUG | console.log | Level.FINEST | Log.d |
|
| 0 | TRACE | console.trace + console.debug | Level.FINEST | Log.d |
|
||||||
| 1 | VERBOSE | console.info | Level.FINE | Log.v |
|
| 1 | DEBUG | console.debug | Level.FINER | Log.d |
|
||||||
| 2 | INFO | console.info | Level.INFO | Log.i |
|
| 2 | VERBOSE | console.info | Level.FINE | Log.v |
|
||||||
| 3 | WARNING | console.warn | Level.WARNING | Log.w |
|
| 3 | INFO | console.info | Level.INFO | Log.i |
|
||||||
| 4 | ERROR | console.error | Level.SEVERE | Log.e |
|
| 4 | WARNING | console.warn | Level.WARNING | Log.w |
|
||||||
| 5 | ASSERT | console.error | Level.SEVERE | Log.wtf |
|
| 5 | ERROR | console.error | Level.SEVERE | Log.e |
|
||||||
|
| 6 | ASSERT | console.error | Level.SEVERE | Log.wtf |
|
||||||
|
|
||||||
Each of these levels have fullname and shortname shortcat extensions:
|
Each of these levels have fullname and shortname shortcat extensions:
|
||||||
|
|
||||||
|
* `KSLog.trace`/`KSLog.t`/`KSLog.tS`
|
||||||
* `KSLog.debug`/`KSLog.d`/`KSLog.dS`
|
* `KSLog.debug`/`KSLog.d`/`KSLog.dS`
|
||||||
* `KSLog.verbose`/`KSLog.v`/`KSLog.vS`
|
* `KSLog.verbose`/`KSLog.v`/`KSLog.vS`
|
||||||
* `KSLog.info`/`KSLog.i`/`KSLog.iS`
|
* `KSLog.info`/`KSLog.i`/`KSLog.iS`
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Setup
|
# Setup
|
||||||
|
|
||||||
## Dependency installation
|
## Dependency installation
|
||||||
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/kslog)
|
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/kslog)
|
||||||
@@ -48,12 +48,13 @@ KSLog(
|
|||||||
Additionally you may use one of several different settings:
|
Additionally you may use one of several different settings:
|
||||||
|
|
||||||
* `minLoggingLevel` - minimal logging level for the log which will be logged. The order of log level is next:
|
* `minLoggingLevel` - minimal logging level for the log which will be logged. The order of log level is next:
|
||||||
* DEBUG
|
* TRACE
|
||||||
* VERBOSE
|
* DEBUG
|
||||||
* INFO
|
* VERBOSE
|
||||||
* WARNING
|
* INFO
|
||||||
* ERROR
|
* WARNING
|
||||||
* ASSERT
|
* ERROR
|
||||||
|
* ASSERT
|
||||||
* `levels` - and iterable with the levels which should be logged
|
* `levels` - and iterable with the levels which should be logged
|
||||||
* `firstLevel`,`secondLevel`,`otherLevels` - as `levels`, but `vararg` :)
|
* `firstLevel`,`secondLevel`,`otherLevels` - as `levels`, but `vararg` :)
|
||||||
|
|
||||||
@@ -150,4 +151,4 @@ KSLog(
|
|||||||
"yourTag"
|
"yourTag"
|
||||||
Logger.getLogger("YourJavaLoggerName")
|
Logger.getLogger("YourJavaLoggerName")
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
121
docs/navigation/getting-started.md
Normal file
121
docs/navigation/getting-started.md
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
# Getting started (TBD)
|
||||||
|
|
||||||
|
[](https://github.com/InsanusMokrassar/navigation)
|
||||||
|
|
||||||
|
Traditionally, you need to add dependency to your project. Currently, there are two types of artifacts:
|
||||||
|
|
||||||
|
* `Core` - only necessary tools for your projects
|
||||||
|
* `MVVM` - Model-View-ViewModel architecture tools + `Core` components
|
||||||
|
|
||||||
|
| Artifact | Purpose | Dependency |
|
||||||
|
|:--------:|-------------------------------------------------------------|-----------------------------------------------------------------|
|
||||||
|
| `Core` | Only necessary tools for your projects | `implementation "dev.inmo:navigation.core:$navigation_version"` |
|
||||||
|
| `MVVM` | Model-View-ViewModel architecture tools + `Core` components | `implementation "dev.inmo:navigation.mvvm:$navigation_version"` |
|
||||||
|
|
||||||
|
# Get started
|
||||||
|
|
||||||
|
After you have added your dependency, you should initialize navigation. There are several important things:
|
||||||
|
|
||||||
|
1. `Config` - it is an instance of any class which extending the `NavigationNodeDefaultConfig` in common case
|
||||||
|
2. `Factory` - usually object which may create a node or some required part for node
|
||||||
|
|
||||||
|
For example: lets imagine that we have a node `Main`. Here what should we do to create a node and make it workable in
|
||||||
|
navigation:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
data class MainConfig(
|
||||||
|
// this id will be used to search an html element by id in JS
|
||||||
|
// and Fragment by tag in Android
|
||||||
|
override val id: String = "main"
|
||||||
|
) : NavigationNodeDefaultConfig
|
||||||
|
```
|
||||||
|
|
||||||
|
Both `JS` and `Android` platforms require `ViewModel` for their `MVVM` node variants, but it can be common as well as
|
||||||
|
`MainConfig`:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
class MainViewModel(
|
||||||
|
node: NavigationNode<MainConfig, NavigationNodeDefaultConfig>
|
||||||
|
) : ViewModel(
|
||||||
|
node
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### JS part
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
// Core variant without MVVM or Compose
|
||||||
|
class MainNode(
|
||||||
|
config: MainConfig,
|
||||||
|
chain: NavigationChain<NavigationNodeDefaultConfig>,
|
||||||
|
) : JsNavigationNode<MainConfig, NavigationNodeDefaultConfig>(
|
||||||
|
chain,
|
||||||
|
config
|
||||||
|
) {
|
||||||
|
// Some code
|
||||||
|
// In htmlElementStateFlow will be found `HTMLElement` where node should be binded
|
||||||
|
}
|
||||||
|
// MVVM Compose variant
|
||||||
|
class MainNodeView(
|
||||||
|
config: MainConfig,
|
||||||
|
chain: NavigationChain<NavigationNodeDefaultConfig>,
|
||||||
|
) : View<MainConfig, MainViewModel>(
|
||||||
|
config,
|
||||||
|
chain
|
||||||
|
) {
|
||||||
|
// Some code
|
||||||
|
// In htmlElementStateFlow will be found `HTMLElement` where node should be binded
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
override onDraw() {
|
||||||
|
Text("Hello world")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object MainNodeFactory : NavigationNodeFactory<NavigationNodeDefaultConfig> {
|
||||||
|
override fun createNode(
|
||||||
|
navigationChain: NavigationChain<Base>,
|
||||||
|
config: Base
|
||||||
|
): NavigationNode<out Base, Base>? = if (config is MainConfig) {
|
||||||
|
MainNode(config, chain) // Or `MainNodeView(config, chain)` for MVVM
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Data below is under TBD
|
||||||
|
|
||||||
|
### Android
|
||||||
|
|
||||||
|
In Android there is one important note: you will not directly work with nodes. In fact it will be required to create
|
||||||
|
special `NodeFragment`:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
// Core variant
|
||||||
|
class MainFragment : NodeFragment<MainConfig, NavigationNodeDefaultConfig>() {
|
||||||
|
// Your code
|
||||||
|
// Here will be available: node with type `AndroidFragmentNode`, config: `MainConfig`
|
||||||
|
}
|
||||||
|
// MVVM Variant
|
||||||
|
class MainViewFragment : ViewFragment<MainViewModel, MainConfig>() {
|
||||||
|
// Will be available also `viewModel` via koin `lazyInject`
|
||||||
|
override val viewModelClass
|
||||||
|
get() = MainViewModel::class
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Initialization is different on the platforms, so, lets take a look at each one.
|
||||||
|
|
||||||
|
## JS
|
||||||
|
|
||||||
|
In `JavaScript` it looks like:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
initNavigation(
|
||||||
|
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
# Navigation
|
# Navigation
|
||||||
|
|
||||||
|
**This library uses koin as preferred DI in MVVM part**
|
||||||
|
|
||||||
Navigation is a library for simple management for your app views (or some other logics). In this library there are several
|
Navigation is a library for simple management for your app views (or some other logics). In this library there are several
|
||||||
important terms:
|
important terms:
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# TelegramBotAPI
|
# TelegramBotAPI
|
||||||
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#august-18-2023)
|
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#september-22-2023)
|
||||||
|
|
||||||
<!--- [](https://t.me/ktgbotapi) --->
|
<!--- [](https://t.me/ktgbotapi) --->
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ nav:
|
|||||||
- 'Krontab':
|
- 'Krontab':
|
||||||
- 'krontab/index.md'
|
- 'krontab/index.md'
|
||||||
- KDocs: 'https://krontab.inmo.dev/'
|
- KDocs: 'https://krontab.inmo.dev/'
|
||||||
|
- Predictor: 'https://insanusmokrassar.github.io/KrontabPredictor'
|
||||||
- Introduction:
|
- Introduction:
|
||||||
- 'krontab/introduction/including-in-project.md'
|
- 'krontab/introduction/including-in-project.md'
|
||||||
- 'krontab/introduction/how-to-use.md'
|
- 'krontab/introduction/how-to-use.md'
|
||||||
@@ -47,6 +48,7 @@ nav:
|
|||||||
- 'kslog/logging.md'
|
- 'kslog/logging.md'
|
||||||
- 'Navigation':
|
- 'Navigation':
|
||||||
- 'navigation/index.md'
|
- 'navigation/index.md'
|
||||||
|
- 'navigation/getting-started.md'
|
||||||
|
|
||||||
use_directory_urls: false
|
use_directory_urls: false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user