数据库-Postgres
我有以下关系:
users <—>> users_organizations <<—> organizations
Run Code Online (Sandbox Code Playgroud)
架构:
table! {
organizations (id) {
id -> Int4,
name -> Varchar,
}
}
table! {
users (id) {
id -> Int4,
name -> Varchar,
email -> Varchar,
password -> Varchar,
}
}
table! {
users_organizations (id, user_id, organization_id) {
id -> Int4,
user_id -> Int4,
organization_id -> Int4,
}
}
Run Code Online (Sandbox Code Playgroud)
楷模:
#[derive(Identifiable, Queryable, Debug, Serialize, Deserialize)]
pub struct Organization {
pub id: i32,
pub name: String,
}
#[derive(Identifiable, Queryable, PartialEq, Debug, Serialize, …Run Code Online (Sandbox Code Playgroud) 我遇到了将内容脚本插入到由history.pushState和ajax调用更改的页面中的问题.我在stackoverflow上找到了类似的主题,但该解决方案对我不起作用(该解决方案是使用chrome.webNavigation.onHistoryStateUpdated和"popstate"事件).
这是我的清单的一个片段:
"content_scripts": [
{
"matches": ["https://vk.com/audios*", "https://vk.com/al_audio.php*"],
"js": ["jquery-2.1.4.min.js", "getListOfSongs.js"]
}
]
Run Code Online (Sandbox Code Playgroud)
chrome.webNavigation.onHistoryStateUpdated仅当我导航到另一个页面时才有效,如果我按顺序多次导航到同一页面没有任何反应.例如:它工作时
1)首次访问https://vk.com/audios* - 首页或重新加载
2)转到https://vk.com/some_other_page - ajax调用
3)转到https://vk.com/audios* - ajax电话
它不起作用
1)首次访问https://vk.com/audios* - 首页或重新加载
2)再次转到https://vk.com/audios* - ajax调用,此时内容脚本没有注入
3)再次转到https://vk.com/audios* - ajax调用,at这一点内容脚本不是注入等等
每次我第二次点击同一页面时依次生成以下请求:
https://vk.com/al_audio.php?__query=audios*********&_ ref = left_nav&_smt = audio%3A2&al = -1&al_id =********&_ rndVer = 60742
(请求参数可能有所不同)
此外 JQuery的.ajaxComplete不赶在这种情况下,任何事件.
并且pushState不会触发"popstate"事件,因此我无法使用window.onpopstate事件
我可能会使用chrome.webNavigation.onDOMContentLoaded和chrome.webNavigation.onCompleted,但是当我重新加载页面时,这些事件发生的时间超过一次,因此脚本将被多次注入.
这种情况的最佳解决方案是什么?