Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@youngbeen/angle-ctrl

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@youngbeen/angle-ctrl - npm Package Compare versions

Comparing version
1.1.19
to
2.0.0-beta.0
+1
-5
dist/index.js

@@ -6,6 +6,4 @@ "use strict";

});
exports.clipboard = exports.debugCtrl = exports.logCtrl = exports.timeCtrl = void 0;
exports.clipboard = exports.debugCtrl = exports.logCtrl = void 0;
var _TimeCtrl = _interopRequireDefault(require("./timeCtrl/TimeCtrl"));
var _LogCtrl = _interopRequireDefault(require("./logCtrl/LogCtrl"));

@@ -19,4 +17,2 @@

var timeCtrl = _TimeCtrl["default"];
exports.timeCtrl = timeCtrl;
var logCtrl = _LogCtrl["default"];

@@ -23,0 +19,0 @@ exports.logCtrl = logCtrl;

+64
-62

@@ -6,73 +6,75 @@ "use strict";

});
exports["default"] = void 0;
var _default = {
countDown: function countDown(_ref) {
var _ref$total = _ref.total,
total = _ref$total === void 0 ? 60 : _ref$total,
_ref$step = _ref.step,
step = _ref$step === void 0 ? 1000 : _ref$step,
_ref$tick = _ref.tick,
tick = _ref$tick === void 0 ? null : _ref$tick,
_ref$end = _ref.end,
end = _ref$end === void 0 ? null : _ref$end;
total > 0 ? total : total = 60;
step > 0 ? step : step = 1000;
exports.countUp = exports.countDown = void 0;
var tickCallback = tick || function () {};
var countDown = function countDown(_ref) {
var _ref$total = _ref.total,
total = _ref$total === void 0 ? 60 : _ref$total,
_ref$step = _ref.step,
step = _ref$step === void 0 ? 1000 : _ref$step;
var tick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var counter;
var stepLength;
total > 0 ? counter = total : counter = 60;
step > 0 ? stepLength = step : stepLength = 1000;
var endCallback = end || function () {};
var tickCallback = tick || function () {};
var tc = setInterval(function () {
if (total > 0) {
tickCallback({
leftCount: total
});
total--;
} else {
endCallback({
leftCount: total
});
clearInterval(tc);
}
}, step);
},
countUp: function countUp(_ref2) {
var _ref2$start = _ref2.start,
start = _ref2$start === void 0 ? 0 : _ref2$start,
_ref2$total = _ref2.total,
total = _ref2$total === void 0 ? 60 : _ref2$total,
_ref2$step = _ref2.step,
step = _ref2$step === void 0 ? 1000 : _ref2$step,
_ref2$tick = _ref2.tick,
tick = _ref2$tick === void 0 ? null : _ref2$tick,
_ref2$end = _ref2.end,
end = _ref2$end === void 0 ? null : _ref2$end;
var endCallback = end || function () {};
if (start > total) {
console.warn('Error: "start" should not large than "total" (countUp()@TimeCtrl)');
return;
var tc = setInterval(function () {
if (counter > 0) {
tickCallback({
leftCount: counter
});
counter--;
} else {
endCallback({
leftCount: counter
});
clearInterval(tc);
}
}, stepLength);
};
var now = start;
step > 0 ? step : step = 1000;
exports.countDown = countDown;
var tickCallback = tick || function () {};
var countUp = function countUp(_ref2) {
var _ref2$start = _ref2.start,
start = _ref2$start === void 0 ? 0 : _ref2$start,
_ref2$total = _ref2.total,
total = _ref2$total === void 0 ? 60 : _ref2$total,
_ref2$step = _ref2.step,
step = _ref2$step === void 0 ? 1000 : _ref2$step;
var tick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var endCallback = end || function () {};
if (start > total) {
console.warn('Error: "start" should not larger than "total" (countUp()@TimeCtrl)');
return;
}
var tc = setInterval(function () {
if (now < total) {
tickCallback({
count: now
});
now++;
} else {
endCallback({
count: now
});
clearInterval(tc);
}
}, step);
}
var now = start;
var stepLength;
step > 0 ? stepLength = step : stepLength = 1000;
var tickCallback = tick || function () {};
var endCallback = end || function () {};
var tc = setInterval(function () {
if (now < total) {
tickCallback({
count: now
});
now++;
} else {
endCallback({
count: now
});
clearInterval(tc);
}
}, step);
};
exports["default"] = _default;
exports.countUp = countUp;
{
"name": "@youngbeen/angle-ctrl",
"version": "1.1.19",
"version": "2.0.0-beta.0",
"description": "The controllers used in angle-FE team",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -1,16 +0,1 @@

export declare const timeCtrl: {
countDown({ total, step, tick, end }: {
total: number;
step: number;
tick: (data: import("./timeCtrl/TimeCtrl").CallbackData) => any;
end: (data: import("./timeCtrl/TimeCtrl").CallbackData) => any;
}): void;
countUp({ start, total, step, tick, end }: {
start: number;
total: number;
step: number;
tick: (data: import("./timeCtrl/TimeCtrl").CallbackData) => any;
end: (data: import("./timeCtrl/TimeCtrl").CallbackData) => any;
}): void;
};
export declare const logCtrl: {

@@ -17,0 +2,0 @@ saveLog(msg: string, type: string, line?: string, compName?: string, funcName?: string, attach?: any): import("./logCtrl/LogCtrl").LogRespond;

@@ -1,8 +0,6 @@

import TimeCtrl from './timeCtrl/TimeCtrl';
import LogCtrl from './logCtrl/LogCtrl';
import DebugCtrl from './debugCtrl/DebugCtrl';
import Clipboard from './clipboard/Clipboard';
export const timeCtrl = TimeCtrl;
export const logCtrl = LogCtrl;
export const debugCtrl = DebugCtrl;
export const clipboard = Clipboard;
// entry js
import TimeCtrl from './timeCtrl/TimeCtrl'
// import TimeCtrl from './timeCtrl/TimeCtrl'
import LogCtrl from './logCtrl/LogCtrl'

@@ -7,5 +7,5 @@ import DebugCtrl from './debugCtrl/DebugCtrl'

export const timeCtrl = TimeCtrl
// export const timeCtrl = TimeCtrl
export const logCtrl = LogCtrl
export const debugCtrl = DebugCtrl
export const clipboard = Clipboard

@@ -7,17 +7,11 @@ export interface CallbackData {

declare type Callback = (data: CallbackData) => any;
declare const _default: {
countDown({ total, step, tick, end }: {
total: number;
step: number;
tick: Callback;
end: Callback;
}): void;
countUp({ start, total, step, tick, end }: {
start: number;
total: number;
step: number;
tick: Callback;
end: Callback;
}): void;
};
export default _default;
export declare const countDown: ({ total, step }: {
total: number;
step: number;
}, tick?: Callback, end?: Callback) => void;
export declare const countUp: ({ start, total, step }: {
start: number;
total: number;
step: number;
}, tick?: Callback, end?: Callback) => void;
export {};

@@ -1,42 +0,43 @@

export default {
countDown({ total = 60, step = 1000, tick = null, end = null }) {
total > 0 ? total : total = 60;
step > 0 ? step : step = 1000;
let tickCallback = tick || function () {
};
let endCallback = end || function () {
};
let tc = setInterval(function () {
if (total > 0) {
tickCallback({ leftCount: total });
total--;
}
else {
endCallback({ leftCount: total });
clearInterval(tc);
}
}, step);
},
countUp({ start = 0, total = 60, step = 1000, tick = null, end = null }) {
if (start > total) {
console.warn('Error: "start" should not large than "total" (countUp()@TimeCtrl)');
return;
export const countDown = ({ total = 60, step = 1000 }, tick = null, end = null) => {
let counter;
let stepLength;
total > 0 ? counter = total : counter = 60;
step > 0 ? stepLength = step : stepLength = 1000;
let tickCallback = tick || function () {
};
let endCallback = end || function () {
};
let tc = setInterval(() => {
if (counter > 0) {
tickCallback({ leftCount: counter });
counter--;
}
let now = start;
step > 0 ? step : step = 1000;
let tickCallback = tick || function () {
};
let endCallback = end || function () {
};
let tc = setInterval(function () {
if (now < total) {
tickCallback({ count: now });
now++;
}
else {
endCallback({ count: now });
clearInterval(tc);
}
}, step);
else {
endCallback({ leftCount: counter });
clearInterval(tc);
}
}, stepLength);
};
export const countUp = ({ start = 0, total = 60, step = 1000 }, tick = null, end = null) => {
if (start > total) {
console.warn('Error: "start" should not larger than "total" (countUp()@TimeCtrl)');
return;
}
let now = start;
let stepLength;
step > 0 ? stepLength = step : stepLength = 1000;
let tickCallback = tick || function () {
};
let endCallback = end || function () {
};
let tc = setInterval(() => {
if (now < total) {
tickCallback({ count: now });
now++;
}
else {
endCallback({ count: now });
clearInterval(tc);
}
}, step);
};

@@ -13,55 +13,62 @@ // this controller is about to provide functions for time controll

export default {
// auto counting down -- { [total], [step], [tick], [end] }
countDown ({ total = 60, step = 1000, tick = null, end = null }: { total: number, step: number, tick: Callback, end: Callback }): void {
total > 0 ? total : total = 60
step > 0 ? step : step = 1000
let tickCallback: Callback = tick || function (): void {
// console.log('tick', result.leftCount)
}
let endCallback: Callback = end || function (): void {
// console.log('end the counting')
}
// auto counting down -- { [total], [step] }, [tick], [end]
export const countDown = ({ total = 60, step = 1000 }: { total: number, step: number },
tick: Callback = null,
end: Callback = null): void => {
let tc: any = setInterval(function (): void {
if (total > 0) {
// time still left
tickCallback({ leftCount: total })
total--
} else {
// counts end
endCallback({ leftCount: total })
clearInterval(tc)
}
}, step)
},
let counter: number
let stepLength: number
total > 0 ? counter = total : counter = 60
step > 0 ? stepLength = step : stepLength = 1000
let tickCallback: Callback = tick || function (): void {
// console.log('tick', result.leftCount)
}
let endCallback: Callback = end || function (): void {
// console.log('end the counting')
}
// auto counting up -- { [start], [total], [step], [tick], [end] }
countUp ({ start = 0, total = 60, step = 1000, tick = null, end = null }: { start: number, total: number, step: number, tick: Callback, end: Callback }): void {
if (start > total) {
// invalid start , total setting
console.warn('Error: "start" should not large than "total" (countUp()@TimeCtrl)')
return
let tc: any = setInterval((): void => {
if (counter > 0) {
// time still left
tickCallback({ leftCount: counter })
counter--
} else {
// counts end
endCallback({ leftCount: counter })
clearInterval(tc)
}
let now: number = start
step > 0 ? step : step = 1000
let tickCallback: Callback = tick || function (): void {
// console.log('tick', result.count)
}
let endCallback: Callback = end || function (): void {
// console.log('end the counting')
}
}, stepLength)
}
let tc: any = setInterval(function (): void {
if (now < total) {
// count continue
tickCallback({ count: now })
now++
} else {
// counts end
endCallback({ count: now })
clearInterval(tc)
}
}, step)
// auto counting up -- { [start], [total], [step] }, [tick], [end]
export const countUp = ({ start = 0, total = 60, step = 1000 }: { start: number, total: number, step: number },
tick: Callback = null,
end: Callback = null): void => {
if (start > total) {
// invalid start , total setting
console.warn('Error: "start" should not larger than "total" (countUp()@TimeCtrl)')
return
}
let now: number = start
let stepLength: number
step > 0 ? stepLength = step : stepLength = 1000
let tickCallback: Callback = tick || function (): void {
// console.log('tick', result.count)
}
let endCallback: Callback = end || function (): void {
// console.log('end the counting')
}
let tc: any = setInterval((): void => {
if (now < total) {
// count continue
tickCallback({ count: now })
now++
} else {
// counts end
endCallback({ count: now })
clearInterval(tc)
}
}, step)
}