This file contains hidden or 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
| const https = require('https') | |
| const options = { | |
| hostname: 'example.com', | |
| port: 443, | |
| method: 'PUT', | |
| headers: { | |
| 'Content-Type': '<whatever>', | |
| Authorization: | |
| 'Bearer <token>', |
This file contains hidden or 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
| [@bs.val] [@bs.scope "performance"] external now : unit => float = ""; | |
| ... | |
| | TouchStart(clientX) => | |
| if (state.nav.isOpen) { | |
| state.nav.isSwiping := true; | |
| }; | |
| ReasonReact.Update({ | |
| ...state, |
This file contains hidden or 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
| [@bs.val] [@bs.scope "performance"] external now : unit => float = ""; |
This file contains hidden or 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
| let x = List.hd(List.rev(self.state.nav.position)); | |
| let x' = List.hd(self.state.nav.position); | |
| ... | |
| <nav | |
| className=(self.state.nav.isOpen ? "active" : "") | |
| onClick=(event => ReactEventRe.Mouse.stopPropagation(event)) | |
| style=( | |
| self.state.nav.isSwiping^ ? |
This file contains hidden or 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
| | TouchStart(clientX) => | |
| if (state.nav.isOpen) { | |
| state.nav.isSwiping := true; | |
| }; | |
| ReasonReact.Update({ | |
| ...state, | |
| nav: { | |
| ...state.nav, | |
| position: [clientX] | |
| } |
This file contains hidden or 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
| let component = ReasonReact.statelessComponent("Page1"); | |
| let make = _children => { | |
| ...component, | |
| render: _self => | |
| <div className="Page1"> | |
| <h1> (ReasonReact.stringToElement("Page1")) </h1> | |
| </div> | |
| }; |
This file contains hidden or 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
| [@bs.val] [@bs.scope "document"] external documentElement : Dom.element = ""; | |
| ... | |
| reducer: (action, state) => | |
| switch action { | |
| | Navigate(_routeWithTitle) => ReasonReact.NoUpdate | |
| | ToggleMenu(isOpen) => | |
| ReasonReact.UpdateWithSideEffects( | |
| { |
This file contains hidden or 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
| reducer: (action, state) => | |
| switch action { | |
| | Navigate(_routeWithTitle) => ReasonReact.NoUpdate | |
| | ToggleMenu(isOpen) => | |
| ReasonReact.UpdateWithSideEffects( | |
| { | |
| ...state, | |
| nav: { | |
| isOpen: isOpen | |
| } |
This file contains hidden or 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
| .App:after { | |
| content: ''; | |
| transition: opacity 450ms cubic-bezier(0.23, 1, 0.32, 1), | |
| transform 0ms cubic-bezier(0.23, 1, 0.32, 1) 450ms; | |
| position: fixed; top: 0; right: 0; bottom: 0; left: 0; | |
| background-color: rgba(0, 0, 0, 0.33); | |
| transform: translateX(-100%); | |
| opacity: 0; | |
| z-index: 1; | |
| } |
This file contains hidden or 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
| render: self => { | |
| let (route, title) = self.state.routeWithTitle; | |
| <div | |
| className=("App" ++ (self.state.nav.isOpen ? " overlay" : "")) | |
| onClick=(_event => self.send(ToggleMenu(false)))> | |
| <header> | |
| <a | |
| onClick=( | |
| event => { | |
| ReactEventRe.Mouse.stopPropagation(event); |
NewerOlder