扫一扫分享
https:Watch.JS是一个小型库,具有很多可能性。您可能知道,“观察者”设计模式涉及在观察到的对象发生更改时执行某些功能。存在执行此操作的其他库,但是使用Watch.JS,您将不必更改开发方式。查看示例,以了解将Watch.JS添加到代码中有多么简单。
适用于:IE 9 +,FF 4 +,SF 5 +,WebKit,CH 7 +,OP 12 +,BESEN,Node.JS,Rhino 1.7+
npm install melanke-watchjs
import WatchJS from 'melanke-watchjs'; var watch = WatchJS.watch; var unwatch = WatchJS.unwatch; var callWatchers = WatchJS.callWatchers;
var WatchJS = require("melanke-watchjs") var watch = WatchJS.watch; var unwatch = WatchJS.unwatch; var callWatchers = WatchJS.callWatchers;
require("watch", function(WatchJS){
var watch = WatchJS.watch;
var unwatch = WatchJS.unwatch;
var callWatchers = WatchJS.callWatchers;
});
手机预览