-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use externals for bindings, not the global object
- Loading branch information
Showing
18 changed files
with
64 additions
and
24 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,6 +1,6 @@ | ||
(library | ||
(name quill) | ||
(js_of_ocaml | ||
(javascript_files js/quill.js)) | ||
(javascript_files quill.js)) | ||
(public_name brr-lwd-ui.bindings.quill) | ||
(libraries brr)) |
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,2 +1,5 @@ | ||
let quill = Jv.get Jv.global "Quill" | ||
let quill_cursors = Jv.get Jv.global "QuillCursors" | ||
external get_quill : unit -> Jv.t = "get_quill" | ||
external get_quill_cursors : unit -> Jv.t = "get_quill_cursors" | ||
|
||
let quill = get_quill () | ||
let quill_cursors = get_quill_cursors () |
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,2 @@ | ||
val quill : Jv.t | ||
val quill_cursors : Jv.t |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
require('quill/dist/quill.core.css') | ||
require('quill/dist/quill.bubble.css') | ||
require('quill/dist/quill.snow.css') | ||
|
||
//Provides: get_quill | ||
function get_quill(){ | ||
return require('quill').default | ||
} | ||
|
||
//Provides: get_quill_cursors | ||
function get_quill_cursors(){ | ||
return require('quill-cursors') | ||
} |
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,6 +1,6 @@ | ||
(library | ||
(name y_quill) | ||
(js_of_ocaml | ||
(javascript_files js/y-quill.js)) | ||
(javascript_files y-quill.js)) | ||
(public_name brr-lwd-ui.bindings.y-quill) | ||
(libraries brr brr-lwd-ui.bindings.quill yjs)) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
//Provides: get_y_quill | ||
function get_y_quill() { | ||
return require('y-quill') | ||
} |
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,6 +1,7 @@ | ||
type t = Jv.t | ||
|
||
external get_awareness_protocol : unit -> Jv.t = "get_awareness_protocol" | ||
external to_jv : t -> Jv.t = "%identity" | ||
|
||
let class_awarness = Jv.get Global.awareness_protocol "Awareness" | ||
let class_awarness = Jv.get (get_awareness_protocol ()) "Awareness" | ||
let make doc = Jv.new' class_awarness [| Doc.Doc.to_jv doc |] |
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,6 +1,6 @@ | ||
(library | ||
(name yjs) | ||
(js_of_ocaml | ||
(javascript_files js/yjs.js)) | ||
(javascript_files yjs.js)) | ||
(public_name brr-lwd-ui.bindings.yjs) | ||
(libraries brr)) |
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,2 +1,3 @@ | ||
let yjs = Jv.get Jv.global "yjs" | ||
let awareness_protocol = Jv.get Jv.global "awarenessProtocol" | ||
external get_yjs : unit -> Jv.t = "get_yjs" | ||
|
||
let yjs = get_yjs () |
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 @@ | ||
val yjs : Jv.t |
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,6 +1,8 @@ | ||
type t = Jv.t | ||
|
||
let indexeddb_persistence = Jv.get Jv.global "IndexeddbPersistence" | ||
external get_indexeddb_persistence : unit -> Jv.t = "get_indexeddb_persistence" | ||
|
||
let indexeddb_persistence = get_indexeddb_persistence () | ||
|
||
let make ~doc_name doc = | ||
Jv.new' indexeddb_persistence [| Jv.of_string doc_name; Doc.Doc.to_jv doc |] |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//Provides: get_yjs | ||
function get_yjs() { | ||
return require('yjs') | ||
} | ||
|
||
//Provides: get_web_rtc_provider | ||
function get_web_rtc_provider() { | ||
return require('y-webrtc').WebrtcProvider | ||
} | ||
|
||
//Provides: get_indexeddb_persistence | ||
function get_indexeddb_persistence() { | ||
return require('y-indexeddb').IndexeddbPersistence | ||
} | ||
|
||
|
||
//Provides: get_awareness_protocol | ||
function get_awareness_protocol() { | ||
return require('y-protocols/awareness.js') | ||
} | ||
|