10 examples of 'watchvue' in JavaScript

Every line of 'watchvue' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
181initWatch() {
182 for (const key in this.watch) {
183 new Watcher(this, key, this.watch[key])
184 }
185}
25function initWatch(vm) {
26 var watch = vm.$options.watch;
27 if (watch) {
28 for (const key in watch) {
29 const handler = watch[key]
30 if (Array.isArray(handler)) {
31 for (let i = 0; i < handler.length; i++) {
32 createWatcher(vm, key, handler[i])
33 }
34 } else {
35 createWatcher(vm, key, handler)
36 }
37 }
38 }
39}
157function initWatch (vm, watch) {
158 for (const key in watch) {
159 const handler = watch[key]
160 if (Array.isArray(handler)) {
161 // 为什么这里会是数组
162 // Sub = Vue.extend({ watch: {a:funcA }}), subvm = new Sub({ watch: {a:funcB })
163 // 最终subvm的options.watch = { "a": [funcA, funcB] }
164 for (let i = 0; i < handler.length; i++) {
165 createWatcher(vm, key, handler[i])
166 }
167 } else {
168 createWatcher(vm, key, handler)
169 }
170 }
171}
92public watchPath(path: string): void {
93 if (!CExample.all[path]) {
94 this.existed = false;
95
96 return;
97 }
98
99 this.existed = true;
100
101 const has: Record = {};
102 const src: Record = {};
103
104 defaultTypes.forEach(ext => {
105 has[ext] = false;
106 src[ext] = '';
107 });
108 CExample.all[path].forEach(ext => {
109 has[ext] = true;
110 src[ext] = '';
111 });
112
113 this.extensions = [...new Set([...defaultTypes, ...CExample.all[path]])];
114 this.has = has;
115 this.src = src;
116
117 this.loadSourceCode();
118}
58const watch = function watch() {
59 gulp.watch(paths.watch.sass, styles)
60}
26function Vue(options) {
27 var self = this; // 实例的对象赋值,防止后期对对象的更改
28 this.data = options.data;
29 this.methods = options.methods;
30
31 // 将data上面的属性代理到vm实例上
32 Object.keys(this.data).forEach(function(key) {
33 self.proxyKeys(key);
34 });
35
36 // 监听数据的变化
37 observe(this.data);
38 // 进行指令的编译
39 new Compile(options.el, this);
40
41 options.mounted.call(this); // 所有事情处理好后执行mounted函数
42}
62export function watch() {
63 gulp.watch(settings.sources.scripts, gulp.series(gulp.parallel(lint, reload))).on('change', informOnChange);
64 gulp.watch(settings.sources.styles, gulp.series(styles, gulp.parallel(lintStyles, reload))).on('change', informOnChange);
65
66 if (useHandlebars) {
67 gulp.watch([
68 ...settings.sources.handlebars,
69 './src/handlebars/layouts/*.hbs',
70 './src/handlebars/partials/**/*.hbs',
71 './src/handlebars/helpers/*.js'
72 ], gulp.series(handlebars, gulp.parallel(lintBootstrap, validateHtml, gulp.series(processHtml, reload)))).on('change', informOnChange);
73 gulp.watch(['./src/handlebars/helpers/*.js'], gulp.parallel(lint)).on('change', informOnChange);
74 } else {
75 gulp.watch(settings.sources.html, gulp.parallel(lintBootstrap, validateHtml, gulp.series(processHtml, reload))).on('change', informOnChange);
76 }
77
78 gulp.watch(settings.sources.images, gulp.series(images, reload)).on('change', informOnChange);
79 gulp.watch(settings.sources.fonts, gulp.series(fonts, reload)).on('change', informOnChange);
80 gulp.watch(settings.sources.appTemplates, gulp.series(appTemplates, reload)).on('change', informOnChange);
81
82 function informOnChange(path) {
83 gutil.log(`File ${chalk.yellow(path)} has changed`);
84 }
85}
51function watch () {
52 webpack(config).watch({}, log)
53}
52export function watch() {
53 watching = true;
54 return gulp.watch('src/**/*.js', babel);
55}
33private w0() {
34 Schedule.multiSelect = this.display.multiSelect;
35 this.schedule.recomputeAll(false, 100);
36}

Related snippets