Add ScopeId::ROOT (#1398)
* add ScopeId::ROOT * replace ScopeId(0) with ScopeId::ROOT --------- Co-authored-by: Jani Mustonen <jani.mustonen@taitounited.fi>
This commit is contained in:
1 parent
de87ba6548
commit
31f8bab20d
22 files changed
+106
-91
No files matched your search
@@ -179,7 +179,7 @@ impl ScopeContext {
|
||||
pub fn provide_root_context<T: 'static + Clone>(&self, context: T) -> T {
|
||||
with_runtime(|runtime| {
|
||||
runtime
|
||||
.get_context(ScopeId(0))
|
||||
.get_context(ScopeId::ROOT)
|
||||
.unwrap()
|
||||
.provide_context(context)
|
||||
})
|
||||
@@ -203,7 +203,7 @@ impl ScopeContext {
|
||||
/// This is good for tasks that need to be run after the component has been dropped.
|
||||
pub fn spawn_forever(&self, fut: impl Future<Output = ()> + 'static) -> TaskId {
|
||||
// The root scope will never be unmounted so we can just add the task at the top of the app
|
||||
let id = self.tasks.spawn(ScopeId(0), fut);
|
||||
let id = self.tasks.spawn(ScopeId::ROOT, fut);
|
||||
|
||||
// wake up the scheduler if it is sleeping
|
||||
self.tasks
|
||||
|
||||
Reference in new issue
Block a user