Skip to content

Commit

Permalink
reduce code
Browse files Browse the repository at this point in the history
  • Loading branch information
yisar committed Apr 21, 2020
1 parent 02c5b15 commit eb06229
Show file tree
Hide file tree
Showing 5 changed files with 790 additions and 577 deletions.
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<body>
<div id="root"></div>
<script src="./src/use-context.js"></script>
<script src="./src/concurrent.js"></script>
</body>

</html>
1 change: 0 additions & 1 deletion demo/src/concurrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ ul.solarsystem li.asteroids_meteorids {
top: 155px;
left: 315px;
z-index: 1;
background: url(http://neography.com/experiment/circles/solarsystem/asteroids_meteorids.png) no-repeat 0 0;
width: 330px;
height: 330px;
border-radius: 165px;
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fre",
"version": "1.13.4",
"version": "1.13.5",
"description": "",
"main": "dist/fre.js",
"unpkg": "dist/fre.js",
Expand All @@ -22,11 +22,11 @@
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.0.0-0",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@babel/plugin-transform-react-jsx": "^7.9.4",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.6.3",
"@babel/preset-react": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@babel/preset-env": "^7.9.5",
"@babel/preset-react": "^7.9.4",
"@babel/preset-typescript": "^7.9.0",
"@types/jest": "^24.0.15",
"babel-jest": "^24.8.0",
"codecov": "^3.6.1",
Expand Down
9 changes: 4 additions & 5 deletions src/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ function flush(iniTime) {
let currentTask = peek(taskQueue)

while (currentTask) {
if (currentTask.dueTime > currentTime && shouldYeild()) {
break
}
const didout = currentTask.dueTime <= currentTime
if (!didout && shouldYeild()) break

let callback = currentTask.callback
currentTask.callback = null
const didout = currentTask.dueTime <= currentTime

let next = callback(didout)
next ? (currentTask.callback = next) : pop(taskQueue)
Expand Down Expand Up @@ -66,4 +65,4 @@ export function shouldYeild() {
return getTime() >= frameDeadline
}

export const getTime = () => performance.now()
export const getTime = () => performance.now()
Loading

0 comments on commit eb06229

Please sign in to comment.