Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely directly on performance.now #3130

Merged
merged 7 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compat/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
REACT_ELEMENT_TYPE,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
} from './render';
export * from './scheduler';

const version = '16.8.0'; // trick libraries to think we are react

Expand Down
5 changes: 1 addition & 4 deletions compat/src/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,4 @@ export function unstable_runWithPriority(priority, callback) {
return callback();
}

export const unstable_now =
typeof performance === 'object' && typeof performance.now === 'function'
? performance.now.bind(performance)
: () => Date.now();
export const unstable_now = () => performance.now();
developit marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion compat/test/browser/scheduler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
unstable_UserBlockingPriority,
unstable_ImmediatePriority,
unstable_now
} from 'preact/compat';
} from '../../src/scheduler';

describe('scheduler', () => {
describe('runWithPriority', () => {
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
"require": "./compat/server.js",
"import": "./compat/server.mjs"
},
"./compat/scheduler": {
"require": "./compat/dist/scheduler.js",
developit marked this conversation as resolved.
Show resolved Hide resolved
"import": "./compat/dist/scheduler.mjs"
},
"./package.json": "./package.json",
"./": "./"
},
Expand All @@ -80,7 +84,7 @@
"build:devtools": "microbundle build --raw --cwd devtools",
"build:hooks": "microbundle build --raw --cwd hooks",
"build:test-utils": "microbundle build --raw --cwd test-utils",
"build:compat": "microbundle build --raw --cwd compat --globals 'preact/hooks=preactHooks'",
"build:compat": "microbundle build src/index.js src/scheduler.js --raw --cwd compat --globals 'preact/hooks=preactHooks'",
"build:jsx": "microbundle build --raw --cwd jsx-runtime",
"postbuild": "node ./config/node-13-exports.js && node ./config/compat-entries.js",
"dev": "microbundle watch --raw --format cjs",
Expand Down