Skip to content

Commit ea81c9b

Browse files
authored
Merge pull request #139 from AllDotPy/fix.ctrl_lifecycle
fletx.core: fix controller.FletXController lifecycle hooks ineffectiv…
2 parents b3df98f + e7f3628 commit ea81c9b

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

fletx/core/controller.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77

88
from typing import (
99
List, Callable, Any, Dict,
10-
Optional, TypeVar, Generic, Union
10+
Optional, TypeVar, Union
1111
)
12-
from abc import ABC, abstractmethod
13-
from contextlib import contextmanager
1412
import asyncio
1513
import weakref
1614
import logging
1715
from enum import Enum
16+
1817
from fletx.core.di import DI
1918
from fletx.core.effects import EffectManager
2019
from fletx.core.state import (
2120
Reactive, RxInt, RxStr, RxBool, RxList, RxDict,
22-
Computed, Observer, ReactiveDependencyTracker
21+
Computed, Observer, # ReactiveDependencyTracker
2322
)
2423
from fletx.utils import get_logger, get_event_loop
2524

@@ -54,7 +53,7 @@ def __init__(
5453
self.type = type
5554
self.data = data
5655
self.source = source
57-
self.timestamp = get_event_loop().time()
56+
# self.timestamp = get_event_loop().time()
5857

5958

6059
####
@@ -368,7 +367,7 @@ def _on_state_change(self):
368367
self._is_ready.value = current_state == ControllerState.READY
369368

370369
# Emit appropiated events
371-
self.emit_local(f"state_changed", current_state)
370+
self.emit_local("state_changed", current_state)
372371

373372
# Call the appropriate lifecycle hook
374373
# Controller is initialized
@@ -536,7 +535,7 @@ def emit_local(self, event_type: str, data: Any = None):
536535
self._event_bus.emit(event_type, data)
537536

538537
def emit_global(self, event_type: str, data: Any = None):
539-
"""Émit an event globally (reactive)"""
538+
"""Emit an event globally (reactive)"""
540539

541540
self._check_not_disposed()
542541
self._global_event_bus.emit(event_type, data)
@@ -665,7 +664,7 @@ def listen_context(
665664
self,
666665
callback: Callable[[], None]
667666
) -> Observer:
668-
"""Listen changes withn local context"""
667+
"""Listen changes within local context"""
669668

670669
self._check_not_disposed()
671670
return self._context.listen(callback)

0 commit comments

Comments
 (0)