Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 17ab4d4

Browse files
authored
feat: add performance api (#170)
* feat: add performance api * add test * change type
1 parent 1c6ef52 commit 17ab4d4

File tree

7 files changed

+19
-2
lines changed

7 files changed

+19
-2
lines changed

lib/js/src/Webapi.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ var Dom = 0;
1010

1111
var $$File = 0;
1212

13+
var $$Performance = 0;
14+
1315
var Url = 0;
1416

1517
exports.Base64 = Base64;
1618
exports.Canvas = Canvas;
1719
exports.Dom = Dom;
1820
exports.$$File = $$File;
21+
exports.$$Performance = $$Performance;
1922
exports.Url = Url;
2023
/* Webapi__Dom Not a pure module */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
4+
window.performance.now();
5+
6+
/* Not a pure module */

src/Webapi.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ module Base64 = Webapi__Base64;
88
module Canvas = Webapi__Canvas;
99
module Dom = Webapi__Dom;
1010
module File = Webapi__File;
11+
module Performance = Webapi__Performance;
1112
module Url = Webapi__Url;

src/Webapi/Webapi__Dom/Webapi__Dom__Window.re

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ type idleDeadline; /* Cooperative Scheduling of Background Tasks */
55
type locationbar; /* "bar object" */
66
type menubar; /* "bar object" */
77
type navigator;
8-
type performance; /* Web Performance API */
98
type personalbar; /* "bar object" */
109
type screen;
1110
type scrollbars; /* "bar object" */
@@ -47,7 +46,7 @@ module Impl = (T: {type t;}) => {
4746
[@bs.get] external pageXOffset : t_window => float = ""; /* alias for scrollX */
4847
[@bs.get] external pageYOffset : t_window => float = ""; /* alias for scrollY */
4948
[@bs.get] external parent : t_window => Dom.window = "";
50-
[@bs.get] external performance : t_window => performance = "";
49+
[@bs.get] external performance : t_window => Webapi__Performance.t = "";
5150
[@bs.get] external personalbar : t_window => personalbar = "";
5251
[@bs.get] external screen : t_window => screen = "";
5352
[@bs.get] external screenX : t_window => int = "";

src/Webapi/Webapi__Performance.re

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type t;
2+
3+
[@bs.send] external now : t => float = "";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let _ =
2+
Webapi.Dom.window
3+
|> Webapi.Dom.Window.performance
4+
|> Webapi.Performance.now;

0 commit comments

Comments
 (0)