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
/* | |
An installer is a package that has a single index.(ts|js) file with a single | |
default export. Its type is | |
class Installer<Options extends InstallerOptions> { | |
steps: InstallerStep[] | |
options: Options | |
} |
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
export const LazyValueState = Record( | |
{ | |
promise: null, | |
value: LOADING, | |
}, | |
'LazyValueState' | |
); |
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
function usePrevious(value) { | |
const prevRef = useRef(); | |
useEffect(() => { | |
prevRef.current = value; | |
}, [value]); | |
return prevRef.current; | |
} | |
function Player({ online, playbackStatus, reload }) { | |
const prevOnline = usePrevious(online); |
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
// Inside of a Dagger module | |
@Singleton | |
@Provides | |
fun provideReactInstanceManager(context: Context): ReactInstanceManager { | |
return ReactInstanceManager.builder() | |
.setApplication(HubspotOneApp.get(context)) | |
.addPackage(MainReactPackage()) | |
.setUseDeveloperSupport(BuildConfig.DEBUG) | |
.setInitialLifecycleState(BEFORE_RESUME) | |
.setJSMainModuleName("index.android") |
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
class ReactResultRouter(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) { | |
@Inject lateinit var reactEventDispatcher: ReactEventDispatcher | |
init { | |
HubspotOneApp.get(reactContext.baseContext).component().inject(this) | |
} | |
override fun getName(): String = "ReactResultRouter" |
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
@Singleton | |
class ReactEventDispatcher @Inject constructor(val reactInstanceManager: ReactInstanceManager) { | |
private val callResults = PublishSubject<ReadableMap>() | |
private var currentKey: Long = 0L | |
private fun nextKey(): Long { | |
currentKey += 1 | |
return currentKey | |
} |
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
import React from 'react' | |
import { DeviceEventEmitter, NativeModules } from 'react-native' | |
const addListener = (event, callback) => { | |
DeviceEventEmitter.addListener(event, ({key, data}) => { | |
// `key` is the numeric key assigned by the native dispatcher, | |
// `data` contains the data that the native call actually wanted to pass | |
NativeModules.ReactResultRouter.routeResults({ | |
key, | |
data: callback(data) |
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
// Inside of a Dagger module | |
@Singleton | |
@Provides | |
fun provideReactInstanceManager(context: Context): ReactInstanceManager { | |
return ReactInstanceManager.builder() | |
.setApplication(HubspotOneApp.get(context)) | |
.addPackage(MainReactPackage()) | |
.setUseDeveloperSupport(BuildConfig.DEBUG) | |
.setInitialLifecycleState(BEFORE_RESUME) | |
.setJSMainModuleName("index.android") |
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
module.exports = { | |
config: { | |
// default font size in pixels for all tabs | |
fontSize: 14, | |
// font family with optional fallbacks | |
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace', | |
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) | |
cursorColor: 'rgba(248,28,229,0.8)', |
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
import java.awt.Color; | |
import javalib.funworld.World; | |
import javalib.worldimages.OverlayImages; | |
import javalib.worldimages.Posn; | |
import javalib.worldimages.RectangleImage; | |
import javalib.worldimages.TextImage; | |
import javalib.worldimages.WorldEnd; | |
import javalib.worldimages.WorldImage; |