@ohos-ports/miniraf 0.0.0-stage → 1.0.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2018 Fisssion LLC.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ <a href="https://travis-ci.org/jlmakes/miniraf"> <img src="https://img.shields.io/travis/jlmakes/miniraf.svg" alt="Build status"> </a>
2
+ <a href="https://coveralls.io/github/jlmakes/miniraf"> <img src="https://img.shields.io/coveralls/jlmakes/miniraf.svg" alt="Coverage"> </a>
3
+ <a href="https://www.npmjs.com/package/miniraf"> <img src="https://img.shields.io/npm/v/miniraf.svg" alt="Version"> </a>
4
+ <img src="https://img.shields.io/badge/min+gzip-0.2_kB-blue.svg" alt="0.2 kB min+gzip">
5
+ <a href="https://github.com/jlmakes/miniraf/blob/master/LICENSE"> <img src="https://img.shields.io/badge/license-MIT-1283c3.svg" alt="MIT License"> </a>
2
6
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
7
+ # Installation
8
+
9
+ ## Browser
10
+
11
+ A simple and fast way to get started is to include this script on your page:
12
+
13
+ ```html
14
+ <script src="https://unpkg.com/miniraf"></script>
15
+ ```
16
+
17
+ This will create the global variable `miniraf`.
18
+
19
+ ## Module
20
+
21
+ ```bash
22
+ npm install miniraf
23
+ ```
24
+
25
+ #### CommonJS
26
+
27
+ ```js
28
+ const miniraf = require('miniraf')
29
+ ```
30
+
31
+ #### ES2015
32
+
33
+ ```js
34
+ import miniraf from 'miniraf'
35
+ ```
@@ -0,0 +1,47 @@
1
+ /*! @license miniraf v1.0.1
2
+
3
+ Copyright 2018 Fisssion LLC.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ */
24
+ var polyfill = (function () {
25
+ var clock = Date.now();
26
+
27
+ return function (callback) {
28
+ var currentTime = Date.now();
29
+ if (currentTime - clock > 16) {
30
+ clock = currentTime;
31
+ callback(currentTime);
32
+ } else {
33
+ setTimeout(function () { return polyfill(callback); }, 0);
34
+ }
35
+ }
36
+ })();
37
+
38
+ var hasWindow = typeof window === 'object' && window !== null;
39
+
40
+ var miniraf = (hasWindow
41
+ ? (window.requestAnimationFrame ||
42
+ window.webkitRequestAnimationFrame ||
43
+ window.mozRequestAnimationFrame ||
44
+ polyfill)
45
+ : polyfill);
46
+
47
+ export default miniraf;
@@ -0,0 +1,55 @@
1
+ /*! @license miniraf v1.0.1
2
+
3
+ Copyright 2018 Fisssion LLC.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ */
24
+ (function (global, factory) {
25
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
26
+ typeof define === 'function' && define.amd ? define(factory) :
27
+ (global.miniraf = factory());
28
+ }(this, (function () { 'use strict';
29
+
30
+ var polyfill = (function () {
31
+ var clock = Date.now();
32
+
33
+ return function (callback) {
34
+ var currentTime = Date.now();
35
+ if (currentTime - clock > 16) {
36
+ clock = currentTime;
37
+ callback(currentTime);
38
+ } else {
39
+ setTimeout(function () { return polyfill(callback); }, 0);
40
+ }
41
+ }
42
+ })();
43
+
44
+ var hasWindow = typeof window === 'object' && window !== null;
45
+
46
+ var miniraf = (hasWindow
47
+ ? (window.requestAnimationFrame ||
48
+ window.webkitRequestAnimationFrame ||
49
+ window.mozRequestAnimationFrame ||
50
+ polyfill)
51
+ : polyfill);
52
+
53
+ return miniraf;
54
+
55
+ })));
@@ -0,0 +1,2 @@
1
+ /*! @license miniraf v1.0.1 (MIT) Copyright 2018 Fisssion LLC. */
2
+ var miniraf=function(){"use strict";var e,i=(e=Date.now(),function(n){var t=Date.now();16<t-e?n(e=t):setTimeout(function(){return i(n)},0)});return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||i}();
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
- "name": "@ohos-ports/miniraf",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@ohos-ports/miniraf",
3
+ "version": "1.0.1-beta.1",
4
+ "description": "ES2015 module to polyfill requestAnimationFrame",
5
+ "main": "dist/miniraf.js",
6
+ "module": "dist/miniraf.es.js",
7
+ "jsnext:main": "dist/miniraf.es.js",
8
+ "types": "src/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "src/index.d.ts"
12
+ ],
13
+ "scripts": {
14
+ "prebuild": "rm -rf dist/*",
15
+ "build": "npm run bundle && npm run bundle:min",
16
+ "bundle": "./node_modules/rollup/bin/rollup -c ./build/rollup.conf.js",
17
+ "bundle:min": "./node_modules/rollup/bin/rollup -c ./build/rollup.conf.min.js",
18
+ "lint": "./node_modules/eslint/bin/eslint.js src test",
19
+ "pretest": "rm -rf .ignore/coverage/**/ && npm run lint",
20
+ "test": "./node_modules/karma/bin/karma start ./test/karma.conf.js",
21
+ "testing": "npm test -- --no-single-run"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/ohos-ports/ohos-ports.git",
26
+ "directory": "ports/miniraf/1.0.1"
27
+ },
28
+ "keywords": [
29
+ "html",
30
+ "element",
31
+ "dom",
32
+ "node"
33
+ ],
34
+ "devDependencies": {
35
+ "chai": "^4.1.2",
36
+ "eslint": "^4.10.0",
37
+ "karma": "^1.3.0",
38
+ "karma-chrome-launcher": "^2.0.0",
39
+ "karma-coverage": "^1.1.1",
40
+ "karma-coveralls": "^1.1.2",
41
+ "karma-mocha": "^1.3.0",
42
+ "karma-mocha-reporter": "^2.2.5",
43
+ "karma-rollup-preprocessor": "^5.0.2",
44
+ "karma-sinon-chai": "^1.3.3",
45
+ "mocha": "^4.0.1",
46
+ "rollup": "^0.51.5",
47
+ "rollup-plugin-buble": "^0.x",
48
+ "rollup-plugin-istanbul": "^1.1.0",
49
+ "rollup-plugin-json": "^2.1.0",
50
+ "rollup-plugin-uglify": "^2.0.1",
51
+ "rollup-watch": "^4.3.1",
52
+ "sinon": "^4.1.3",
53
+ "sinon-chai": "^2.14.0"
54
+ },
55
+ "author": "Julian Lloyd <me@jlmak.es>",
56
+ "license": "MIT"
57
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export as namespace miniraf;
2
+
3
+ export = miniraf;
4
+
5
+ type Callback = (time: number) => any;
6
+
7
+ declare function miniraf(callback: Callback): void;