Skip to content

Commit

Permalink
refactor: use only native idle
Browse files Browse the repository at this point in the history
  • Loading branch information
kobezzza committed Nov 8, 2024
1 parent 1802747 commit d60ef21
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/component/decorators/component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import type { ComponentConstructor, ComponentOptions } from 'core/component/inte

const OVERRIDDEN = Symbol('This class is overridden in the child layer');

const HAS_NATIVE_IDLE = requestIdleCallback.toString().includes('[native code]');

/**
* Registers a new component based on the tied class
*
Expand Down Expand Up @@ -118,6 +120,9 @@ export function component(opts?: ComponentOptions): Function {

if (needRegisterImmediate) {
registerComponent(componentFullName);

} else if (HAS_NATIVE_IDLE) {
requestIdleCallback(registerComponent.bind(null, componentFullName));
}

// If we have a smart component,
Expand Down

0 comments on commit d60ef21

Please sign in to comment.