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
// deno run -A --unstable main.ts | |
export const classToValue = { | |
request: 0x0000, | |
indication: 0x0010, | |
success: 0x0100, | |
failure: 0x0110, | |
}; | |
export const methodToValue = { |
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
import invariant from "tiny-invariant"; | |
class AmalgoBox extends HTMLElement { | |
get input() { | |
return this.querySelector("input") as HTMLInputElement; | |
} | |
get button() { | |
return this.querySelector("button") as HTMLButtonElement; | |
} |
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 is an advanced example! It is not typically required for application code. | |
// If you are using a library like Redux or MobX, use the container component provided by that library. | |
// If you are authoring such a library, use the technique shown below. | |
// This example shows how to safely update subscriptions in response to props changes. | |
// In this case, it is important to wait until `componentDidUpdate` before removing a subscription. | |
// In the event that a render is cancelled before being committed, this will prevent us from unsubscribing prematurely. | |
// We also need to be careful about how we handle events that are dispatched in between | |
// `getDerivedStateFromProps` and `componentDidUpdate` so that we don't put stale values into the `state`. |
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
// @flow | |
import React, { Component } from "react"; | |
import PropTypes from "prop-types"; | |
import App from "./components/App"; | |
type Props = { | |
environment: *, | |
queryTracker?: * | |
}; |
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
import React from 'react'; | |
let lastScrollY = 0; | |
let ticking = false; | |
class App extends React.Component { | |
componentDidMount() { | |
window.addEventListener('scroll', this.handleScroll, true); | |
} |