avatar

nonk

Nonk is a scratchpad. I made it to replace my phone’s notes app, which had more features than I needed

ui.background(0, 0, 0)

const file = 'nonk.txt'
const data = fileio.loadTextFromFile(file)
const pad = ui.addTextArea(0, 0, 1, .9)
pad.onChange(e => fileio.saveTextToFile(e.text, file))

const confirmation = ui.popup()
  .title('clear notes?')
  .ok('yes').cancel('no')
  .onAction(function (data) {
    if (!data.accept) return
    pad.text('')
    fileio.saveTextToFile('', file)
    ui.toast('notes cleared')
  })

const clearButton = ui.addButton('-', .05, .925, .2, .05)
  .onClick(() => confirmation.show())

pad.text(data)
nonk source code