@essentials/raf
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -1,36 +0,36 @@ | ||
'use strict' | ||
"use strict"; | ||
exports.__esModule = true | ||
exports.now = exports.caf = exports.raf = void 0 | ||
exports.__esModule = true; | ||
exports.now = exports.caf = exports.raf = void 0; | ||
let u = 'undefined', | ||
win = typeof window !== u ? window : {}, | ||
p = typeof performance !== u ? performance : Date, | ||
now = () => p.now(), | ||
af = 'AnimationFrame', | ||
Caf = 'cancel' + af, | ||
Raf = 'request' + af, | ||
raf = win[Raf] && win[Raf].bind(win), | ||
caf = win[Caf] && win[Caf].bind(win) | ||
win = typeof window !== u ? window : {}, | ||
p = typeof performance !== u ? performance : Date, | ||
now = () => p.now(), | ||
af = 'AnimationFrame', | ||
Caf = 'cancel' + af, | ||
Raf = 'request' + af, | ||
raf = win[Raf] && /*#__PURE__*/win[Raf].bind(win), | ||
caf = win[Caf] && /*#__PURE__*/win[Caf].bind(win); | ||
exports.caf = caf | ||
exports.raf = raf | ||
exports.now = now | ||
exports.caf = caf; | ||
exports.raf = raf; | ||
exports.now = now; | ||
function _ref(h) { | ||
return clearTimeout(h) | ||
return clearTimeout(h); | ||
} | ||
if (!raf || !caf) { | ||
let lastTime = 0 | ||
let lastTime = 0; | ||
exports.raf = raf = (callback) => { | ||
exports.raf = raf = callback => { | ||
let curr = now(), | ||
next = Math.max(lastTime + 1000 / 60, curr) | ||
next = Math.max(lastTime + 1000 / 60, curr); | ||
return setTimeout(() => { | ||
callback((lastTime = next)) | ||
}, next - curr) | ||
} | ||
callback(lastTime = next); | ||
}, next - curr); | ||
}; | ||
exports.caf = caf = _ref | ||
} | ||
exports.caf = caf = _ref; | ||
} |
let u = 'undefined', | ||
win = typeof window !== u ? window : {}, | ||
p = typeof performance !== u ? performance : Date, | ||
now = () => p.now(), | ||
af = 'AnimationFrame', | ||
Caf = 'cancel' + af, | ||
Raf = 'request' + af, | ||
raf = win[Raf] && win[Raf].bind(win), | ||
caf = win[Caf] && win[Caf].bind(win) | ||
win = typeof window !== u ? window : {}, | ||
p = typeof performance !== u ? performance : Date, | ||
now = () => p.now(), | ||
af = 'AnimationFrame', | ||
Caf = 'cancel' + af, | ||
Raf = 'request' + af, | ||
raf = win[Raf] && /*#__PURE__*/win[Raf].bind(win), | ||
caf = win[Caf] && /*#__PURE__*/win[Caf].bind(win); | ||
function _ref(h) { | ||
return clearTimeout(h) | ||
return clearTimeout(h); | ||
} | ||
if (!raf || !caf) { | ||
let lastTime = 0 | ||
let lastTime = 0; | ||
raf = (callback) => { | ||
raf = callback => { | ||
let curr = now(), | ||
next = Math.max(lastTime + 1000 / 60, curr) | ||
next = Math.max(lastTime + 1000 / 60, curr); | ||
return setTimeout(() => { | ||
callback((lastTime = next)) | ||
}, next - curr) | ||
} | ||
callback(lastTime = next); | ||
}, next - curr); | ||
}; | ||
caf = _ref | ||
caf = _ref; | ||
} | ||
export {raf, caf, now} | ||
export { raf, caf, now }; |
{ | ||
"name": "@essentials/raf", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"homepage": "https://github.com/jaredLunde/essentials/tree/master/packages/raf#readme", | ||
@@ -21,24 +21,37 @@ "repository": "github:jaredLunde/essentials", | ||
"module": "dist/module/index.js", | ||
"unpkg": "dist/umd/raf.js", | ||
"source": "src/index.ts", | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"/dist", | ||
"/src", | ||
"/types" | ||
], | ||
"exports": { | ||
".": { | ||
"browser": "./dist/module/index.js", | ||
"import": "./dist/esm/index.mjs", | ||
"require": "./dist/main/index.js", | ||
"umd": "./dist/umd/raf.js", | ||
"source": "./src/index.ts", | ||
"types": "./types/index.d.ts", | ||
"default": "./dist/main/index.js" | ||
}, | ||
"./package.json": "./package.json", | ||
"./": "./" | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "npm run build-main && npm run build-module && npm run build-types", | ||
"build-main": "npm run compile -- -d dist/main --env-name main", | ||
"build-module": "npm run compile -- -d dist/module --env-name module", | ||
"build-types": "tsc -p tsconfig.json -d --outDir types --emitDeclarationOnly", | ||
"check-types": "tsc --noEmit -p tsconfig.json", | ||
"compile": "babel src -x .ts --ignore \"**/*.test.ts\",\"**/test.ts\" --delete-dir-on-start", | ||
"format": "prettier --write \"**/*.{ts,js,md,yml,json,eslintrc,prettierrc}\"", | ||
"build": "lundle build", | ||
"check-types": "lundle check-types", | ||
"dev": "lundle build -f module,cjs -w", | ||
"format": "prettier --write \"{,!(node_modules|dist|coverage)/**/}*.{ts,js,md,yml,json}\"", | ||
"lint": "eslint . --ext .ts", | ||
"prepublishOnly": "npm run lint && npm run test && npm run build && npm run format", | ||
"test": "jest", | ||
"validate": "npm run check-types && npm run lint && npm run test -- --coverage" | ||
"validate": "lundle check-types && npm run lint && jest --coverage" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run build-types && git add types && lint-staged" | ||
"pre-commit": "lint-staged" | ||
} | ||
@@ -48,2 +61,3 @@ }, | ||
"**/*.{ts,js}": [ | ||
"lundle build -f types", | ||
"eslint", | ||
@@ -56,15 +70,55 @@ "prettier --write" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"lunde" | ||
], | ||
"rules": { | ||
"import/no-mutable-exports": "off", | ||
"prefer-const": "off" | ||
} | ||
}, | ||
"eslintIgnore": [ | ||
"node_modules", | ||
"coverage", | ||
"dist", | ||
"test", | ||
"*.config.js" | ||
], | ||
"jest": { | ||
"testEnvironment": "node", | ||
"moduleDirectories": [ | ||
"node_modules", | ||
"src", | ||
"test" | ||
], | ||
"testMatch": [ | ||
"<rootDir>/src/**/?(*.)test.ts" | ||
], | ||
"collectCoverageFrom": [ | ||
"**/src/**/*.ts" | ||
], | ||
"setupFilesAfterEnv": [ | ||
"./test/setup.js" | ||
], | ||
"snapshotResolver": "./test/resolve-snapshot.js", | ||
"globals": { | ||
"__DEV__": true | ||
} | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false | ||
}, | ||
"devDependencies": { | ||
"@lunde/babel-preset-es": "latest", | ||
"@types/jest": "latest", | ||
"@typescript-eslint/eslint-plugin": "latest", | ||
"@typescript-eslint/parser": "latest", | ||
"babel-jest": "latest", | ||
"babel-plugin-annotate-pure-calls": "latest", | ||
"eslint": "latest", | ||
"eslint-import-resolver-jest": "latest", | ||
"eslint-plugin-jest": "latest", | ||
"eslint-config-lunde": "latest", | ||
"husky": "latest", | ||
"jest": "latest", | ||
"lint-staged": "latest", | ||
"lundle": "latest", | ||
"prettier": "latest", | ||
"ts-jest": "latest", | ||
"typescript": "latest" | ||
@@ -71,0 +125,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12066
11
12
105