UNPKG

mtfunit

Version:

Mtfunit is a tiny JavaScript library that includes useful functions to operate strings and DOM

3,143 lines (999 loc) 41.6 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Adding meta --> <!-- Adding external script--> <!-- Adding external style--> <!-- Adding scripts--> <!-- Adding style--> <!-- Adding overlay script--> <!-- Adding overlay style--> <title>Global</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/third-party/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/third-party/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> <link type="text/css" rel="stylesheet" href="styles/clean-jsdoc-theme-base.css"> <link type="text/css" rel="stylesheet" href="styles/clean-jsdoc-theme-light.css"> <svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"> <defs> <symbol id="copy-icon" viewbox="0 0 488.3 488.3"> <g> <path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/> <path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/> </g> </symbol> </defs> </svg> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <h2><a href="index.html"><div class="text">Home</div></a></h2><div class="search-box"><input type="text" placeholder="Search..." id="search-box" /><div class="search-item-container" id="search-item-container"><ul class="search-item-ul" id="search-item-ul"></ul></div></div><div class="sidebar-list-div"><h3><a href="global.html">Global</a></h3><ul><li><a href="global.html#$">$</a></li><li><a href="global.html#addClass">addClass</a></li><li><a href="global.html#debounce">debounce</a></li><li><a href="global.html#delHtmlTag">delHtmlTag</a></li><li><a href="global.html#getAbsoluteUrl">getAbsoluteUrl</a></li><li><a href="global.html#htmlEncode">htmlEncode</a></li><li><a href="global.html#insertAfter">insertAfter</a></li><li><a href="global.html#isRefererValid">isRefererValid</a></li><li><a href="global.html#javaScriptEncode">javaScriptEncode</a></li><li><a href="global.html#query">query</a></li><li><a href="global.html#removeClass">removeClass</a></li><li><a href="global.html#removeItemByIndex">removeItemByIndex</a></li><li><a href="global.html#removeItemByValue">removeItemByValue</a></li><li><a href="global.html#removeNode">removeNode</a></li><li><a href="global.html#serialize">serialize</a></li><li><a href="global.html#stringifyJSON">stringifyJSON</a></li><li><a href="global.html#throttle">throttle</a></li></ul></div> </nav> <div id="main"> <h1 id='page-title' class="page-title">Global</h1> <section> <article> <div class="container-overview"> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="$"> <a href="#$">#</a> <span class="type-signature"></span>$<span class="signature">(selector)</span><span class="type-signature"> &rarr; {DOM|Null|Array}</span> </h4> <div class="description"> 根据选择器查找 DOM </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>selector</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">选择器名称,用法同CSS选择器</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line29">line 29</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 群组选择器(含,)返回Array。其他选择器,找到返回第一个DOM,没有返回Null </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">DOM</span> | <span class="param-type">Null</span> | <span class="param-type">Array</span> </dd> </dl> </div> <h4 class="name" id="addClass"> <a href="#addClass">#</a> <span class="type-signature"></span>addClass<span class="signature">(node, className)</span><span class="type-signature"> &rarr; {DOM|ArrayLike}</span> </h4> <div class="description"> 添加类名 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>node</code></td> <td class="type"> <span class="param-type">DOM</span> | <span class="param-type">ArrayLike</span> </td> <td class="description last">要添加类名的节点或节点列表</td> </tr> <tr> <td class="name"><code>className</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Array</span> </td> <td class="description last">要添加的类名</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line74">line 74</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回添加类名的节点或节点列表,与传参 node 相同 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">DOM</span> | <span class="param-type">ArrayLike</span> </dd> </dl> </div> <h4 class="name" id="debounce"> <a href="#debounce">#</a> <span class="type-signature"></span>debounce<span class="signature">(callback, time)</span><span class="type-signature"> &rarr; {function}</span> </h4> <div class="description"> 防抖 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">回调函数</td> </tr> <tr> <td class="name"><code>time</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">延迟时间</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line119">line 119</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 防抖的函数 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> </div> <h4 class="name" id="delHtmlTag"> <a href="#delHtmlTag">#</a> <span class="type-signature"></span>delHtmlTag<span class="signature">(html)</span><span class="type-signature"> &rarr; {String}</span> </h4> <div class="description"> 富文本 → 纯文本 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>html</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">富文本字符串</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line195">line 195</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回纯文本字符串 ALL HTML TAG List Source:https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </div> <h4 class="name" id="getAbsoluteUrl"> <a href="#getAbsoluteUrl">#</a> <span class="type-signature"></span>getAbsoluteUrl<span class="signature">(url)</span><span class="type-signature"> &rarr; {String}</span> </h4> <div class="description"> 获取绝对路径 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>url</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">// 相对路径</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line94">line 94</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> // 返回路径的值与浏览器处理相对路径相同 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </div> <h4 class="name" id="htmlEncode"> <a href="#htmlEncode">#</a> <span class="type-signature"></span>htmlEncode<span class="signature">(html)</span><span class="type-signature"> &rarr; {String}</span> </h4> <div class="description"> 转义:HTML → HTMLEntites </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>html</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">富文本字符串</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line205">line 205</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回转义后的字符串,转换非ASCII编码字符 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </div> <h4 class="name" id="insertAfter"> <a href="#insertAfter">#</a> <span class="type-signature"></span>insertAfter<span class="signature">(node, target)</span><span class="type-signature"> &rarr; {DOM|ArrayLike}</span> </h4> <div class="description"> 在 target 节点之后插入 node 节点 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>node</code></td> <td class="type"> <span class="param-type">DOM</span> | <span class="param-type">ArrayLike</span> </td> <td class="description last">要插入的节点或节点列表</td> </tr> <tr> <td class="name"><code>target</code></td> <td class="type"> <span class="param-type">DOM</span> | <span class="param-type">Null</span> </td> <td class="description last">插入目标节点的后方,若目标节点不存在,则插入父节点的末尾</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line60">line 60</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回被插入的节点或节点列表,与传参 node 相同 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">DOM</span> | <span class="param-type">ArrayLike</span> </dd> </dl> </div> <h4 class="name" id="isRefererValid"> <a href="#isRefererValid">#</a> <span class="type-signature"></span>isRefererValid<span class="signature">(referer, nullable, })</span><span class="type-signature"></span> </h4> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>referer</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">来源</td> </tr> <tr> <td class="name"><code>nullable</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">允许为空:默认允许</td> </tr> <tr> <td class="name"><code>}</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">whiteList 白名单:域名 + 端口 白名单(不含http和https)</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line234">line 234</a> </li></ul></dd> </div> </dl> <h4 class="name" id="javaScriptEncode"> <a href="#javaScriptEncode">#</a> <span class="type-signature"></span>javaScriptEncode<span class="signature">(js)</span><span class="type-signature"> &rarr; {String}</span> </h4> <div class="description"> 转义:JavaScript代码 → 字符串 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>js</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">JavaScript代码</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line219">line 219</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回转义后的字符串,转换非ASCII编码字符 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </div> <h4 class="name" id="query"> <a href="#query">#</a> <span class="type-signature"></span>query<span class="signature">(name, querystring)</span><span class="type-signature"> &rarr; {String|undefined}</span> </h4> <div class="description"> 获取指定的 querystring 中指定 name 的 value </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">查询名</td> </tr> <tr> <td class="name"><code>querystring</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">查询到的值</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line7">line 7</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 查询到返回String,没有返回undefined </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> | <span class="param-type">undefined</span> </dd> </dl> </div> <h4 class="name" id="removeClass"> <a href="#removeClass">#</a> <span class="type-signature"></span>removeClass<span class="signature">(node, className)</span><span class="type-signature"> &rarr; {DOM|ArrayLike}</span> </h4> <div class="description"> 移除类名 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>node</code></td> <td class="type"> <span class="param-type">DOM</span> | <span class="param-type">Array.&lt;Dom></span> </td> <td class="description last">要移除类名的节点或节点列表</td> </tr> <tr> <td class="name"><code>className</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Array</span> </td> <td class="description last">要移除的类名</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line85">line 85</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回移除类名的节点或节点列表,与传参 node 相同 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">DOM</span> | <span class="param-type">ArrayLike</span> </dd> </dl> </div> <h4 class="name" id="removeItemByIndex"> <a href="#removeItemByIndex">#</a> <span class="type-signature"></span>removeItemByIndex<span class="signature">(index, arr)</span><span class="type-signature"> &rarr; {Array}</span> </h4> <div class="description"> 根据索引移出数组的某一项 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>index</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">要删除的索引。正负和边界处理与Array.prototype.splice的第一参数相同</td> </tr> <tr> <td class="name"><code>arr</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">要操作的数组</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line153">line 153</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回操作后的数组 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> </div> <h4 class="name" id="removeItemByValue"> <a href="#removeItemByValue">#</a> <span class="type-signature"></span>removeItemByValue<span class="signature">(index, arr)</span><span class="type-signature"> &rarr; {Array}</span> </h4> <div class="description"> 根据值移出数组的某一项 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>index</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">要删除的值。严格相等匹配与Array.prototype.indexOf相同</td> </tr> <tr> <td class="name"><code>arr</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">要操作的数组</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line171">line 171</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回操作后的数组 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> </div> <h4 class="name" id="removeNode"> <a href="#removeNode">#</a> <span class="type-signature"></span>removeNode<span class="signature">(node)</span><span class="type-signature"> &rarr; {DOM|ArrayLike}</span> </h4> <div class="description"> 删除 DOM 节点 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>node</code></td> <td class="type"> <span class="param-type">DOM</span> | <span class="param-type">ArrayLike</span> </td> <td class="description last">要删除的节点或节点列表</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line50">line 50</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回值被删除的节点或节点列表,与传参 node 相同 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">DOM</span> | <span class="param-type">ArrayLike</span> </dd> </dl> </div> <h4 class="name" id="serialize"> <a href="#serialize">#</a> <span class="type-signature"></span>serialize<span class="signature">(data)</span><span class="type-signature"> &rarr; {String}</span> </h4> <div class="description"> 序列化对象,把对象转成URL查询字符串 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">对象</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line18">line 18</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回查询字符串 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </div> <h4 class="name" id="stringifyJSON"> <a href="#stringifyJSON">#</a> <span class="type-signature"></span>stringifyJSON<span class="signature">(obj)</span><span class="type-signature"> &rarr; {String}</span> </h4> <div class="description"> JSON.stringify:保留对象中undefined、BigInt值和Function、Symbol结构 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>obj</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">JS对象</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line184">line 184</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 返回序列化后的字符串 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </div> <h4 class="name" id="throttle"> <a href="#throttle">#</a> <span class="type-signature"></span>throttle<span class="signature">(callback, time)</span><span class="type-signature"> &rarr; {function}</span> </h4> <div class="description"> 节流 </div> <div class="method-member-container flex flex-col w-100 overflow-auto mt-20"> <strong>Parameters:</strong> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">回调函数</td> </tr> <tr> <td class="name"><code>time</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">时间间隔</td> </tr> </tbody> </table> </div> <dl class="details"> <div class="details-item-container"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mtfunit.js.html">mtfunit.js</a>, <a href="mtfunit.js.html#line136">line 136</a> </li></ul></dd> </div> </dl> <div class="method-member-container mt-20"> <strong>Returns:</strong> <div class="param-desc"> 节流的函数 </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> </div> </article> </section> </div> <footer id="footer"> </footer> <script src="scripts/third-party/prettify.js"></script> <script src="scripts/third-party/lang-css.js"></script> <script src="scripts/search.js"></script> <script src="scripts/third-party/fuse.js"></script> <script type="text/javascript" src="scripts/misc.js"></script> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> <script src="scripts/fix-code-block.js"></script> <script> var list = [{"title":"$","link":"<a href=\"global.html#$\">Global &rtrif; $</a>"},{"title":"addClass","link":"<a href=\"global.html#addClass\">Global &rtrif; addClass</a>"},{"title":"debounce","link":"<a href=\"global.html#debounce\">Global &rtrif; debounce</a>"},{"title":"delHtmlTag","link":"<a href=\"global.html#delHtmlTag\">Global &rtrif; delHtmlTag</a>"},{"title":"getAbsoluteUrl","link":"<a href=\"global.html#getAbsoluteUrl\">Global &rtrif; getAbsoluteUrl</a>"},{"title":"htmlEncode","link":"<a href=\"global.html#htmlEncode\">Global &rtrif; htmlEncode</a>"},{"title":"insertAfter","link":"<a href=\"global.html#insertAfter\">Global &rtrif; insertAfter</a>"},{"title":"isRefererValid","link":"<a href=\"global.html#isRefererValid\">Global &rtrif; isRefererValid</a>"},{"title":"javaScriptEncode","link":"<a href=\"global.html#javaScriptEncode\">Global &rtrif; javaScriptEncode</a>"},{"title":"query","link":"<a href=\"global.html#query\">Global &rtrif; query</a>"},{"title":"removeClass","link":"<a href=\"global.html#removeClass\">Global &rtrif; removeClass</a>"},{"title":"removeItemByIndex","link":"<a href=\"global.html#removeItemByIndex\">Global &rtrif; removeItemByIndex</a>"},{"title":"removeItemByValue","link":"<a href=\"global.html#removeItemByValue\">Global &rtrif; removeItemByValue</a>"},{"title":"removeNode","link":"<a href=\"global.html#removeNode\">Global &rtrif; removeNode</a>"},{"title":"serialize","link":"<a href=\"global.html#serialize\">Global &rtrif; serialize</a>"},{"title":"stringifyJSON","link":"<a href=\"global.html#stringifyJSON\">Global &rtrif; stringifyJSON</a>"},{"title":"throttle","link":"<a href=\"global.html#throttle\">Global &rtrif; throttle</a>"}]; var options = setupSearch(list, options) </script> </body> </html>