Forge frontend tech update
Introduced lately
- Haxe
- tink_core
- Typed reflibs
- tink_state
Haxe
- DevTalks Winter 2020
- Code Style Guide
tink_core
Generic type-safe building blocks for common problems
- CallbackLink
- Future
- Outcome
- Promise
- Signal
- some other stuff
tink_core: CallbackLink
- For all kinds of "cancellable" registrations/operations
- Most often used for callbacks (thus the name)
- Public API: the cancel() method ;-)
- Ensures single invokation
- Create from a function
- Join multiple into a single CallbackLink
- null is a valid value (noop, not NPE)
tink_core: Future
- Represents asynchronous result
- Composability
- inParallel/inSequence
- map/flatMap
- FutureTools.combine
- Can be lazy and suspendable
tink_core: Future
tink_core: Future
tink_core: Outcome
- Represents success/failure outcome
- Explicit and type-safe
- Helper methods included
tink_core: Promise
- Represents asynchronous outcome
- Essentially a Future<Outcome<T,Error>>
- Same API as Future
- + convenience methods for dealing with errors
- next
- recover
- Promise.resolve
- Promise.reject
- etc.
- Our own helpers:
- then
- PromiseTools.combine
tink_core: Promise
tink_core: Promise
tink_core: Signal
- Generic one-to-many notification primitive
- Listener API separate from trigger API
- Composability
- map/filter
- nextTime
- Can be lazy and suspendable
Typed reflibs
- Type-safe asset libraries
- Generated by ATC
- defined via gunnerfile
- in sync with asset repo
- More info here
OnStageHandler
- Do actions when object comes to the stage
- Undo actions when it leaves the stage
- GC-friendly, replaces explicit dispose in most cases
- Great for managing external bindings
- Event/Signal
- Observable
tink_state: Reactive State Handling
- Observable state primitives
- Automatic derived data updates
- Efficient computations and bindings
- Plays well with tink_core
- ObservableArray/ObservableMap
tink_state: The Idea
tink_state: The Idea
Inventory state
(from BE)
Search string
(from User)
Current page
(from User)
Matching items
Items to display
Number of pages
Has prev page?
Has next page?
tink_state: Basics
tink_state: binding
- Synchronously calls handler for the first time
- On-change binding invokations are batched
- bindings are invoked once per frame
- bindings are only invoked if the value actually changes
- Configurable
- custom comparators
- direct invokation instead of batching
tink_state: auto-observable
- Create observables from a compute function
- Automatically tracks "parent" observables
- Invalidates when parents change
- Recomputes on the next access
- and caches the result until next invalidation
tink_state: Predicted/Promised
Convenience tools for observing Future/Promise results
Forge frontend tech update
By Dan Korostelev
Forge frontend tech update
- 1,165