Skip to content

Instantly share code, notes, and snippets.

@ianaya89
Created October 5, 2020 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianaya89/9acf4ca11ec462ce93e0ac432a2d01ef to your computer and use it in GitHub Desktop.
Save ianaya89/9acf4ca11ec462ce93e0ac432a2d01ef to your computer and use it in GitHub Desktop.
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