TOAST UI Tools: Code Snippet

一组实用的方法,使 javascript 应用程序的开发变得简单。「Group of utility methods to make ease with developing javascript applications.」

  • 所有者: nhn/tui.code-snippet
  • 平台: Linux, Mac, Windows
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

TOAST UI Tools: Code Snippet

Group of utility methods to make ease with developing javascript applications.

GitHub release
npm
GitHub license
PRs welcome
code with hearth by NHN

🚩 Table of Contents

📙 Documents

You can also see the older versions of API page on the releases page.

🎨 Features

  • ajax
    • Send the Ajax request
  • array
    • Handle arrays
  • browser
    • Detect browser
  • collection
    • Process collections
    • Support util methods for collections
  • customEvents
    • Add/Remove/fire custom events
  • defineClass
    • Define classes
  • domEvent
    • Add, remove, fire DOM events
    • Control mouse events
  • domUtil
    • Control the information of DOM
    • Add, remove, find DOM class name
  • enum
    • Manage constant value
    • Make immutability values but IE8 low
  • formatDate
    • Format date strings
  • inheritance
    • Simple inheritance (Nicholas C. Zakas, YUI Library)
    • Call supur constructor of superclass
    • Have to get inheritance before define child
    • Use mixin and inner object
  • object
    • Support utils to control object
  • request
    • Request image ping
  • string
    • Support utils such as decodeHTMLEntity, encodeHTMLEntity
  • tricks
    • Creates a debounced function and a throttled function
  • type
    • Check data type

💾 Install

TOAST UI products can be used by using the package manager or downloading the source directly. However, we highly recommend using the package manager.

Via Package Manager

TOAST UI products are registered in two package managers, npm.
You can conveniently install it using the commands provided by each package manager.
When using npm, be sure to use it in the environment Node.js is installed.

npm

$ npm install --save tui-code-snippet # Latest version
$ npm install --save tui-code-snippet@<version> # Specific version

Download Source Files

🔨 Usage

Import only functions that you need in your code:

var func = require('tui-code-snippet/<folder>/<function>');

// for example,
var inArray = require('tui-code-snippet/array/inArray');
var customEvents = require('tui-code-snippet/customEvents/customEvents');

The folder structure can be found here.

Bundle

Since v2.0, it does not provide bundle files. If you need a bundle file, you should make it yourself using the command npm run bundle.

$ git clone https://github.com/nhn/tui.code-snippet.git
$ cd tui.code-snippet
$ npm install
$ npm run bundle

After executing npm run bundle, the uncompressed(tui-code-snippet.js) and minified(tui-code-snippet.min.js) files are created in the dist folder.

tui.code-snippet/
├─ dist
│  ├─ tui-code-snippet.js
│  ├─ tui-code-snippet.min.js
├─ ...

The entry file is index.js. When you do not modify index.js, all methods of tui.code-snippet will be included in the bundle file. To bundle the methods you need, remove other methods in the entry file.

// index.js
// for example, you need inArray, forEach and isArray methods only.
require('./array/inArray');
require('./collection/forEach');
require('./type/isArray');

🌏 Browser Support

Chrome Internet Explorer Edge Safari Firefox
Yes 8+ Yes Yes Yes

🔧 Pull Request Steps

TOAST UI products are open source, so you can create a pull request(PR) after you fix issues.
Run npm scripts and develop yourself with the following process.

Setup

Fork master branch into your personal repository.
Clone it to local computer. Install node modules.
Before starting development, you should check to have any errors.

$ git clone https://github.com/{your-personal-repo}/tui.code-snippet.git
$ cd tui.code-snippet
$ npm install
$ npm run test

Develop

Let's start development!
Don't miss adding test cases and then make green rights.

Run karma test

$ npm run test

Pull Request

Before PR, check to test lastly and then check any errors.
If it has no error, commit and then push it!

For more information on PR's step, please see links of Contributing section.

💬 Contributing

🍞 TOAST UI Family

📜 License

This software is licensed under the MIT License © NHN.

主要指標

概覽
名稱與所有者nhn/tui.code-snippet
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台Linux, Mac, Windows
許可證MIT License
所有者活动
創建於2015-05-06 09:18:55
推送於2023-07-09 10:14:33
最后一次提交2022-04-01 15:30:01
發布數33
最新版本名稱v2.3.3 (發布於 )
第一版名稱0.1.0 (發布於 )
用户参与
星數91
關注者數14
派生數41
提交數621
已啟用問題?
問題數22
打開的問題數3
拉請求數28
打開的拉請求數12
關閉的拉請求數21
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?