0.12.4 • Published 2 months ago

bigonion-kit v0.12.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Onion 的 dev-kit

NPM version license

下载(Download)

npm i bigonion-kit

简介(Introduction)

本 NPM 包提供了
This NPM package provides

  • moveIt
  • findId
  • findClass
  • setCookie
  • getCookie
  • log
  • sleep
  • addStyle
  • removeAddedStyle
  • sound2Word
  • getUUID
  • ajax
  • isFocus 常用方法(未完待续...)

支持 umd,web 请使用 umd 来导入(Support umd, please use umd to import web)

eg:

<script src="https://cdn.jsdelivr.net/npm/bigonion-kit/umd/umd-kit.min.js"></script>

ES6 导入

<script type="module">
  import kit from "https://cdn.jsdelivr.net/npm/bigonion-kit/index.min.mjs";
  window.kit = kit; window.moveIt = kit.moveIt; window.findId = kit.findId;
  window.findClass = kit.findClass; window.setCookie = kit.setCookie;
  window.getCookie = kit.getCookie; window.log = kit.log; window.sleep =
  kit.sleep; window.version=kit.version;
</script>

Nodejs

import kit from "bigonion-kit";

或 commonJS 规范

const kit = require("bigonion-kit/umd/umd-kit.js");

来快速导入

函数详情 (Function details)

web 已经挂载全局变量,可以直接输入kit来查看已有的函数 也可以直接控制台输入

log("你好");

来使用

sleep

Eg:

/**
 * fast pause some time, just like delay function
 * @param {int} time
 * @return {Promise}
 * @public
 */

sleep(3000).then(() => {
  log("你已经成功导入devKit");
});

log

Eg:

/**
 * fast log sth...
 * @param {string} a
 * @public
 */

log("Nihao");

findId

Eg:

/**
 * fast find Element by Id
 * @param {string} id
 * @return {Object}
 * @public
 */

findId("id");

findClass

Eg:

/**
 * fast find Element by className
 * @param {string} className
 * @return {Array}
 * @public
 */

findClass("className");

moveIt

Eg:

/**
 * fast move Sth by holding on "controlEle" to move "movedEle"
 * @param {Object} controlEle
 * @param {Object} movedEle
 * @public
 */
controlEle = findId("controlEle");
movedEle = findId("movedEle");
moveIt(controlEle, movedEle);

setCookie

Eg:

/**
 * fast set cookie by Native function
 * @param {string} cname
 * @param {Any} cvalue
 * @param {int} exdays {days}
 * @public
 */

setCookie("cookieName", "cookieValue", 30);

getCookie

Eg:

/**
 * fast get cookie value
 * @param {string} cname
 * @return {string} cvalue
 * @public
 */

getCookie("cookieName");

setClipBoard

Eg:

/**
 * fast get cookie value
 * @param {string} text
 * @public
 */

setClipBoard("你好");

isFocus

/**
 * Judge whether an element is in focus
 * @param {object} element
 * @return {boolean}
 * @public
 */

isFocus(element);

ajax

/**
 * fast send request with ajax
 * @param {string} url
 * @param {string} way
 * @param {boolean} async
 * @param {JSON} header
 * @param {function} onload
 * @return {Object}
 * @public
 */
ajax({
  url: "https://example.com",
  way: "GET",
  async: true,
  header: { "content-type": "json" },
  onload: (data) => {
    console.log(data.response);
  },
});
//注意:不能跨域

getUUID

Eg:

/**
 * fast get cookie value
 * @return {string}
 * @public
 */
kit.getUUID();

sound2Word

Eg:

/**
 * 控制台快捷语音识别
 * @return {string}
 */

kit.sound2Word();

addStyle

Eg:

/**
 * add some style
 * @param {string}
 */
kit.addStyle(`
body{
    background:pink
    }
`);

removeAddedStyle

Eg:

/**
 * remove all the added Cssstyle
 */
kit.removeAddedStyle();

版本更新日志(Version update log)

v0.4.x demo Ver
v0.5.3 增加了 esm 和 umd 模块
v0.7.4 增加了 isFocus、ajax、setClipboard、getUUID
v0.8.4 增加了 addStyle、removeAddedStyle
v0.9.8 原型链方法增加 move

开源协议(Open source agreement)

MIT

作者(Author)

bigonion

nameSpace:
bigonion.cn
md.bigonion.cn ai.bigonion.cn Email: bigonion@bigonion.cn && olderonion@gmail.com

声明:未经本人同意,禁止转载、搬运、抄袭!

0.12.3

3 months ago

0.12.4

2 months ago

0.12.0

3 months ago

0.12.1

3 months ago

0.12.2

3 months ago

0.11.0

11 months ago

0.11.1

11 months ago

0.11.2

11 months ago

0.10.16

11 months ago

0.10.15

1 year ago

0.9.12

1 year ago

0.9.8

1 year ago

0.9.13

1 year ago

0.9.9

1 year ago

0.9.10

1 year ago

0.9.11

1 year ago

0.10.14

1 year ago

0.10.13

1 year ago

0.9.7

1 year ago

0.9.6

1 year ago

0.9.5

1 year ago

0.8.4

1 year ago

0.7.4

1 year ago

0.6.4

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.4.3

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.2.2

1 year ago

0.1.2

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago