worker_plus_sys/
cache.rs

1use wasm_bindgen::prelude::*;
2
3use crate::{Request, Response};
4
5// An instance of cache
6#[wasm_bindgen]
7extern "C" {
8    #[wasm_bindgen(extends = ::js_sys::Object, js_name = Cache)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    pub type Cache;
11
12    #[wasm_bindgen(structural, method, js_class=Cache, js_name = put)]
13    pub fn put_request(this: &Cache, request: &Request, response: &Response) -> ::js_sys::Promise;
14
15    #[wasm_bindgen(structural, method, js_class=Cache, js_name = put)]
16    pub fn put_url(this: &Cache, url: &str, response: &Response) -> ::js_sys::Promise;
17
18    #[wasm_bindgen(structural, method, js_class=Cache, js_name=match)]
19    pub fn match_request(this: &Cache, request: &Request, options: JsValue) -> ::js_sys::Promise;
20
21    #[wasm_bindgen(structural, method, js_class=Cache, js_name=match)]
22    pub fn match_url(this: &Cache, url: &str, options: JsValue) -> ::js_sys::Promise;
23
24    #[wasm_bindgen(structural, method, js_class=Cache, js_name=delete)]
25    pub fn delete_request(this: &Cache, request: &Request, options: JsValue) -> ::js_sys::Promise;
26
27    #[wasm_bindgen(structural, method, js_class=Cache, js_name=delete)]
28    pub fn delete_url(this: &Cache, request: &str, options: JsValue) -> ::js_sys::Promise;
29}
30
31// `caches` global object
32#[wasm_bindgen]
33extern "C" {
34
35    #[wasm_bindgen(js_name = Caches)]
36    pub type Caches;
37
38    #[wasm_bindgen(method, structural, getter, js_class = "Caches")]
39    pub fn default(this: &Caches) -> Cache;
40
41    #[wasm_bindgen(method, structural, js_class = "Caches")]
42    pub fn open(this: &Caches, cache_name: String) -> ::js_sys::Promise;
43
44}