Created
October 5, 2020 11:53
-
-
Save ianaya89/9acf4ca11ec462ce93e0ac432a2d01ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readline = require('readline') | |
const { ref, watchEffect, computed } = require('vue') | |
const read = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}) | |
const number = ref(0) | |
const double = computed(() => n.value * 2) | |
watchEffect(() => | |
process.stdout.write('\nThis is a Vue Watcher in Node.js: '+ number.value + '\n')) | |
watchEffect(() => | |
process.stdout.write('This is a Vue Computed in Node.js: '+ double.value + '\n')) | |
const question = () => read.question('\nType a number: ', (value) => { | |
number.value = value | |
setInterval(question, 100) | |
}) | |
question() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment