Source file browser_action_chrome_common.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
open Ezjs_min
open Extension_utils
type uint8Array = Typed_array.uint8Array
class type imageData = object
method data : uint8Array t prop
method height : int prop
method width : int prop
end
class type tabDetails = object
method tabId : int optdef prop
end
class type titleDetails = object
inherit tabDetails
method title : js_string t opt prop
end
class type iconDetails = object
inherit tabDetails
method imageData : imageData t optdef prop
method path : js_string t optdef prop
end
class type = object
inherit tabDetails
method popup : js_string t opt prop
end
class type badgeDetails = object
inherit tabDetails
method text : js_string t opt prop
end
class type badgeColorDetails = object
inherit tabDetails
method color : js_string t opt prop
end
class type browserAction = object
method setTitle : titleDetails t -> (unit -> unit) callback optdef -> unit meth
method getTitle : tabDetails t -> (js_string t -> unit) callback -> unit meth
method setIcon : iconDetails t -> (unit -> unit) callback optdef -> unit meth
method setPopup : popupDetails t -> (unit -> unit) callback optdef -> unit meth
method getPopup : tabDetails t -> (js_string t -> unit) callback -> unit meth
method setBadgeText : badgeDetails t -> (unit -> unit) callback optdef -> unit meth
method getBadgeText : tabDetails t -> (js_string t -> unit) callback -> unit meth
method setBadgeBackgroundColor : badgeColorDetails t -> (unit -> unit) callback optdef -> unit meth
method getBadgeBackgroundColor : tabDetails t -> (uint8Array t -> unit) callback -> unit meth
method enable : int optdef -> (unit -> unit) callback optdef -> unit meth
method disable : int optdef -> (unit -> unit) callback optdef -> unit meth
method onClicked : Tabs.tab Browser.event t prop
end
let browserAction : browserAction t = Unsafe.global##.chrome##.browserAction
let onClicked f =
Browser.addListener1 browserAction##.onClicked f