Skip to content

Instantly share code, notes, and snippets.

@wilsoncook
wilsoncook / watchObject.ts
Last active February 4, 2021 06:11
Monitor a object's properties modifications or reads deeply(用于监控对象属性更改的工具方法(支持无限层级,循环引用),可以非常快速地追溯Mutable更改(可保留执行栈))
export class WatchObjectOptions {
/** How deep do we put a proxy */
depth? = 10;
nameKey? = Symbol('$keyName');
nameParent? = Symbol('$parent');
// nameAppliedProxy? = Symbol('$appliedProxy');
@clinyong
clinyong / build.js
Created March 11, 2016 15:38
webpack build script.
import webpack from 'webpack'
import config from './webpack'
import swig from 'swig'
import fs from 'fs'
function writeTemplate (name) {
let sourceTemplate = config.templatePath + '/prod.tmpl'
let targetTemplate = config.buildTemplatePath + '/index.tmpl'
let content = swig.renderFile(sourceTemplate, {name})
fs.writeFile(targetTemplate, content, err => {
@mrzmyr
mrzmyr / index.js
Created November 22, 2015 16:56
React Native - Detect Double Tap
var Index = React.createClass({
getInitialState: function () {
return {
lastPress: 0
}
},
onPress: function () {
var delta = new Date().getTime() - this.state.lastPress;