Browse Source

refactor: ensure functions moved to api are prefixed with .api elsewhere

main
familyfriendlymikey 2 years ago
parent
commit
3a6803564c
  1. 2
      app/components/app-bang.imba
  2. 2
      app/components/app-community-links.imba
  3. 2
      app/components/app-edit.imba
  4. 2
      app/components/app-links.imba
  5. 6
      app/components/app-settings.imba
  6. 2
      app/db.imba
  7. 1
      scripts/api_move.sh

2
app/components/app-bang.imba

@ -4,7 +4,7 @@ tag app-bang
"{active_bang.url}{window.encodeURIComponent(state.query)}"
def handle_bang
await increment_link_frequency state.active_bang
await api.increment_link_frequency state.active_bang
window.location.href = encoded_bang_query
def render

2
app/components/app-community-links.imba

@ -26,7 +26,7 @@ tag app-community-links
def add_community_link link
await db.links.add link
await reload_db!
await api.reload_db!
imba.commit!
def render

2
app/components/app-edit.imba

@ -22,7 +22,7 @@ tag app-edit
save_config!
state.query = prior_query
prior_query = ''
sort_links!
api.sort_links!
def handle_delete
try

2
app/components/app-links.imba

@ -18,7 +18,7 @@ tag app-links
try
await window.navigator.clipboard.writeText(s)
state.query = ''
sort_links!
api.sort_links!
def handle_cut e
return unless e.target.selectionStart == e.target.selectionEnd

6
app/components/app-settings.imba

@ -45,10 +45,10 @@ tag app-settings
return err "importing db", e
for link_text in links
try
let link = await create_link_from_text link_text
let link = await api.create_link_from_text link_text
if name_exists link.name
throw "Name already exists, add manually if you don't mind duplicates."
add_link link_text
api.add_link link_text
catch e
errors.push "{link_text}\n{e}"
if errors.length > 0
@ -61,7 +61,7 @@ tag app-settings
def handle_click_export
loading = yes
await reload_db!
await api.reload_db!
let links = state.links.map do |link|
api.construct_link_text link
let datetime = new Date!.toString!.split(" ")

2
app/db.imba

@ -28,7 +28,7 @@ db.version(3).stores({
p "upgrading to fuzzyhome db version 3"
trans.links.toCollection!.modify! do |link|
try
link.url = parse_url(link.url).href
link.url = api.parse_url(link.url).href
db.version(4).stores({
links: "++id,display_name,name,is_bang,is_pinned,url,frequency,icon"

1
scripts/api_move.sh

@ -0,0 +1 @@
printf "\033c" && rg --pcre2 -g '!api.imba' '(?<!api.)'"$1"
Loading…
Cancel
Save