terminal:
npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx
let storage = window.localStorage; | |
/** | |
* 判断是否为 JSON 对象 | |
* @param obj | |
* @returns {boolean} | |
*/ | |
function isJSON(obj) { | |
obj = JSON.stringify(obj); | |
return /^\{[\s\S]*\}$/.test(obj); |
const Promise = require('bluebird'); | |
const sh = require('shelljs'); | |
/** | |
* Asynchronously executes a shell command and returns a promise that resolves | |
* with the result. | |
* | |
* The `opts` object will be passed to shelljs's `exec()` and then to Node's native | |
* `child_process.exec()`. The most commonly used opts properties are: | |
* |
terminal:
npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx
import { useEffect, useRef } from 'react' | |
// playground: https://stackblitz.com/edit/react-ts-nv5fxe?file=App.tsx | |
export default function App() { | |
// create a ref and declare an instance for each countUp animation | |
const countupRef = useRef(null); | |
let countUpAnim; | |