annotate libervia/pages/_browser/tmp_aio.py @ 1387:a84383c659b4

lists: creation, invitation, item deletion: this big patch includes: - reorganisation of pages for consistency, discovery is now the main list page, and list overview is now in `view` while item view is moved to `view_item` - lists from lists of interest are now shown in discovery page - list deletion from discory page - list can now be created, using templates now available from backend - invitation manager can now be used from list overview - list item can now be deleted from `view_item`
author Goffi <goffi@goffi.org>
date Sat, 20 Feb 2021 14:07:22 +0100
parents 48e2a8b07c0b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1347
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
1 from browser import window
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
2
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
3 """Q&D module to do ajax requests with data types currently unsupported by Brython"""
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # FIXME: remove this module when official aio module allows to work with blobs
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
5
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
6 window.eval("""
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
7 var _tmp_ajax = function(method, url, format, data){
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
8 return new Promise(function(resolve, reject){
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
9 var xhr = new XMLHttpRequest()
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
10 xhr.open(method, url, true)
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
11 xhr.responseType = format
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
12 xhr.onreadystatechange = function(){
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
13 if(this.readyState == 4){
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
14 resolve(this)
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
15 }
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
16 }
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
17 if(data){
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
18 xhr.send(data)
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
19 }else{
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
20 xhr.send()
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
21 }
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
22 })
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
23 }
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
24 """)
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
25
48e2a8b07c0b browser: async version of bridge
Goffi <goffi@goffi.org>
parents:
diff changeset
26 ajax = window._tmp_ajax