Skip to content

Commit

Permalink
♻️ create a utils folder and move utility functions there
Browse files Browse the repository at this point in the history
this way it's easier to understand the code
  • Loading branch information
astoilkov committed Jan 11, 2024
1 parent e8b7177 commit 15d418a
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export { default as isTimeToYield } from './src/isTimeToYield'
export type { default as SchedulingPriority } from './src/SchedulingPriority'

// utility
export { default as Deferred } from './src/Deferred'
export { default as queueTask } from './src/queueTask'
export { default as afterFrame } from './src/requestAfterFrame'
export { default as Deferred } from './src/utils/Deferred'
export { default as queueTask } from './src/utils/queueTask'
export { default as afterFrame } from './src/utils/requestAfterFrame'
2 changes: 1 addition & 1 deletion src/isTimeToYield.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import state from './state'
import hasValidContext from './hasValidContext'
import hasValidContext from './utils/hasValidContext'
import SchedulingPriority from './SchedulingPriority'

// #performance
Expand Down
2 changes: 1 addition & 1 deletion src/state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Task } from './tasks'
import Deferred from './Deferred'
import Deferred from './utils/Deferred'

type State = {
tasks: Task[]
Expand Down
2 changes: 1 addition & 1 deletion src/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import state from './state'
import Deferred from './Deferred'
import Deferred from './utils/Deferred'
import { startTracking } from './tracking'
import SchedulingPriority from './SchedulingPriority'

Expand Down
2 changes: 1 addition & 1 deletion src/tracking.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import state from './state'
import Deferred from './Deferred'
import Deferred from './utils/Deferred'

let isTracking = false
let idleCallbackId: number | undefined
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/yieldControl.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import state from './state'
import queueTask from './queueTask'
import queueTask from './utils/queueTask'
import isTimeToYield from './isTimeToYield'
import hasValidContext from './hasValidContext'
import hasValidContext from './utils/hasValidContext'
import SchedulingPriority from './SchedulingPriority'
import { createTask, nextTask, removeTask } from './tasks'
import { cancelPromiseEscape, requestPromiseEscape } from './promiseEscape'
import { cancelPromiseEscape, requestPromiseEscape } from './utils/promiseEscape'

let promiseEscapeId: number | undefined

Expand Down
2 changes: 1 addition & 1 deletion test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isTimeToYield, yieldControl, yieldOrContinue } from './index'
import Deferred from './src/Deferred'
import Deferred from './src/utils/Deferred'

let hasValidContext = true
jest.mock('./src/hasValidContext', () => {
Expand Down

0 comments on commit 15d418a

Please sign in to comment.