@oipage/core.js 0.1.0-alpha.0 → 0.1.0-alpha.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/README.md +1 -1
- package/dist/corejs.js +3 -3
- package/dist/corejs.min.js +1 -1
- package/package.json +2 -2
- package/src/animation/index.d.ts +4 -2
- package/src/animation/index.js +1 -1
- package/src/index.js +2 -2
- package/src/throttle/index.d.ts +4 -2
- package/src/throttle/index.js +1 -1
- package/types/index.d.ts +2 -2
package/README.md
CHANGED
package/dist/corejs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @oipage/core.js v0.1.0-alpha.
|
|
2
|
+
* @oipage/core.js v0.1.0-alpha.1
|
|
3
3
|
* git+https://github.com/oi-contrib/core.js.git
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* @returns {function} 返回一个函数,调用该函数,可以提前结束动画
|
|
25
25
|
*/
|
|
26
|
-
function animation
|
|
26
|
+
function animation(doback, duration, callback) {
|
|
27
27
|
if (arguments.length < 2) duration = 400;
|
|
28
28
|
if (arguments.length < 3) callback = function () { };
|
|
29
29
|
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
function throttle
|
|
114
|
+
function throttle(callback, _option) {
|
|
115
115
|
|
|
116
116
|
// 缺省值
|
|
117
117
|
var option = {
|
package/dist/corejs.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @oipage/core.js v0.1.0-alpha.
|
|
2
|
+
* @oipage/core.js v0.1.0-alpha.1
|
|
3
3
|
* git+https://github.com/oi-contrib/core.js.git
|
|
4
4
|
*/
|
|
5
5
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Corejs=e()}(this,(function(){"use strict";var t,e=[];var n={animation:function(n,i,r){arguments.length<2&&(i=400),arguments.length<3&&(r=function(){});var o={timer:function(t,n,i){if(!t)throw new Error("Tick is required!");var r=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return e.push({id:r,createTime:new Date,tick:t,duration:n,callback:i}),o.start(),r},start:function(){t||(t=setInterval(o.tick,13))},tick:function(){var t,n,i,r,a,u,f,l=e;for((e=[]).length=0,n=0;n<l.length;n++)t=(a=l[n]).createTime,i=a.tick,u=a.duration,r=a.callback,i(f=(f=(+(new Date).valueOf()-t.valueOf())/u)>1?1:f),f<1&&a.id?e.push(a):r(f);e.length<=0&&o.stop()},stop:function(){t&&(clearInterval(t),t=null)}},a=o.timer((function(t){n(t)}),i,r);return function(){var t;for(t in e)if(e[t].id==a)return void(e[t].id=void 0)}},throttle:function(t,e){var n={time:200,keep:!1,opportunity:"end"};if(e)for(var i in e)n[i]=e[i];var r,o=!1,a=!1,u=!1;return function(){const e=this;if(r=arguments,o)a=!0,u=!0;else{"end"!=n.opportunity&&t.apply(e,r),o=!0;var i=setInterval((()=>{a?n.keep||t.apply(e,r):("begin"!=n.opportunity&&(u||"end"==n.opportunity)&&t.apply(e,r),o=!1,u=!1,clearInterval(i)),a=!1}),n.time)}}}};return n}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oipage/core.js",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
4
|
"description": "前端开发常用基础&核心方法",
|
|
5
5
|
"main": "dist/corejs.min.js",
|
|
6
6
|
"typings": "./types/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"bugs": {
|
|
25
25
|
"url": "https://github.com/oi-contrib/core.js/issues"
|
|
26
26
|
},
|
|
27
|
-
"homepage": "https://oi-contrib
|
|
27
|
+
"homepage": "https://github.com/oi-contrib/core.js",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"devby": "^0.7.0",
|
|
30
30
|
"rollup": "^4.6.1",
|
package/src/animation/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ interface animationFun {
|
|
|
5
5
|
/**
|
|
6
6
|
* 轮询动画,返回一个函数,调用该函数,可以提前结束动画
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export interface animationType {
|
|
9
9
|
(doback: animationFun, duration?: number, callback?: animationFun): Function
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export let animation: animationType
|
package/src/animation/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var $timerId;
|
|
|
13
13
|
*
|
|
14
14
|
* @returns {function} 返回一个函数,调用该函数,可以提前结束动画
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export function animation(doback, duration, callback) {
|
|
17
17
|
if (arguments.length < 2) duration = 400;
|
|
18
18
|
if (arguments.length < 3) callback = function () { };
|
|
19
19
|
|
package/src/index.js
CHANGED
package/src/throttle/index.d.ts
CHANGED
package/src/throttle/index.js
CHANGED
package/types/index.d.ts
CHANGED