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

motto-timer

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

motto-timer - npm Package Compare versions

Comparing version
0.0.4
to
0.0.5
+100
release/bundle.js
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/index.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("/**\n * 定时器构造函数\n * @param {number} interval 间隔(单位:毫秒)\n * @param {number} step_size 步长(小于或等于0表示无限循环,直到调用this.stop();才停止)\n * @param {function} loop_fn 循环函数(执行时,会传入{loop_fn_params},并附加cur_step属性)\n * @param {JSON} loop_fn_params [可空] 循环函数参数\n * @param {function} finish_fn [可空] 任务结束函数(执行时,会传入{finish_fn_params},并附加cur_step属性)\n * @param {JSON} finish_fn_params [可空] 循环函数参数\n */\nfunction Timer(interval, step_size, loop_fn, loop_fn_params, finish_fn, finish_fn_params) {\n this._interval = interval;\n this._step_size = step_size;\n this._loop_fn = typeof loop_fn !== 'function' ? function () { } : loop_fn;\n this._loop_fn_params = loop_fn_params == null ? {} : loop_fn_params;\n this._finish_fn = typeof finish_fn !== 'function' ? function () { } : finish_fn;\n this._finish_fn_params = finish_fn_params == null ? {} : finish_fn_params;\n this._toggle = false;\n this._is_dead = false;\n this._cur_step = 0;\n}\n\n/**\n * 是否完成\n * @returns {boolean} ture: 完成, false: 未完成\n */\nTimer.prototype.isFinish = function () {\n return this._step_size > 0 && this._step_size == this._cur_step;\n};\n\n/**\n * 启动\n */\nTimer.prototype.start = function () {\n // this._cur_step = 0;\n if (this._is_dead) return;\n this._toggle = true;\n var thiz = this;\n setTimeout(function () { Timer.exec(thiz); }, this._interval);\n};\n\n/**\n * 暂停\n */\nTimer.prototype.pause = function () {\n this._toggle = false;\n};\n\n/**\n * 停止\n */\nTimer.prototype.stop = function () {\n this._toggle = false;\n this._is_dead = true;\n this._step_size = this._cur_step = 1;\n};\n\n/**\n * 执行定时器\n * @param {Timer} timer Timer对象\n */\nTimer.exec = function (timer) {\n if (!timer._toggle) return;\n timer._cur_step++;\n if (timer.isFinish()) {\n timer._finish_fn_params.cur_step = timer._cur_step;\n timer._finish_fn(timer._finish_fn_params);\n } else {\n timer._loop_fn_params['cur_step'] = timer._cur_step;\n timer._loop_fn(timer._loop_fn_params);\n setTimeout(function () { Timer.exec(timer); }, timer._interval);\n }\n};\n\ntry {\n window.Timer = Timer;\n} catch (e) { }\n\nmodule.exports = Timer;\n\n//# sourceURL=webpack:///./src/index.js?");
/***/ })
/******/ });
+1
-1
{
"name": "motto-timer",
"version": "0.0.4",
"version": "0.0.5",
"description": "简单易用的JS定时器",

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

@@ -7,5 +7,5 @@ var path = require('path');

output: {
path: path.resolve(__dirname, 'dist'),
path: path.resolve(__dirname, 'release'),
filename: 'bundle.js'
}
};