-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
72 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
_build/ | ||
*.install | ||
*.merlin | ||
test | ||
*.merlin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
## 0.1 - 2020-07-31 | ||
|
||
First release | ||
|
||
## 0.2 - 2020-10-24 | ||
|
||
- more exhaustive binding | ||
- update to ezjs_min.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,6 @@ | |
(depends | ||
(ocaml (>= 4.05)) | ||
(dune (>= 2.0)) | ||
ezjs_min)) | ||
(ezjs_min (>= 0.2)) | ||
bigstring | ||
(base64 (>= 3.2)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(executable | ||
(name index_example) | ||
(modules index_example) | ||
(preprocess (pps js_of_ocaml-ppx)) | ||
(libraries ezjs_push) | ||
(modes js)) | ||
|
||
(executable | ||
(name sw_example) | ||
(modules sw_example) | ||
(preprocess (pps js_of_ocaml-ppx)) | ||
(libraries ezjs_push) | ||
(modes js)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html> | ||
<head> | ||
<title>Test Push Notification</title> | ||
<link rel="manifest" href="/manifest.json"/> | ||
<script src="index_example.bc.js"></script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
open Ezjs_min | ||
open Ezjs_push | ||
|
||
let () = | ||
request_permission @@ fun permission -> | ||
js_log permission; | ||
registration "/sw_example.bc.js" @@ fun reg -> | ||
update_worker reg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "Test Push Notifications", | ||
"gcm_sender_id": "..." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
open Ezjs_min | ||
open Ezjs_push | ||
|
||
let () = | ||
onactivate (fun _ev -> | ||
log_str "service worker activation"; | ||
let options = { | ||
so_user_visible_only = Some true; | ||
so_application_server_key = Some "BMDc6lvxIgN4aluWtZSZokp5GcJedJwgHUzRUVqFlTHzJl26o4eZTdokJ7svKn7MyaugUXeOc00F7cPh_922-Os" | ||
} in | ||
subscription ~options self##.registration (fun subscr -> | ||
js_log subscr; | ||
js_log @@ subscr##toJSON); | ||
); | ||
onpush (fun e -> | ||
log_str "received a push message"; | ||
let data = Opt.case e##.data (fun () -> "no payload") (fun d -> to_string d##text) in | ||
let options = {empty_notif with no_body = Some data} in | ||
show_notification ~options self##.registration "test") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
(library | ||
(public_name ezjs_push) | ||
(preprocess (pps js_of_ocaml-ppx)) | ||
(libraries ezjs_min bigstring base64)) | ||
(libraries ezjs_min bigstring base64) | ||
(modes byte)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters