mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
* Move talk-server/config to talk-common/config * Refactor build into /src/core/build and use common config * Add embed webpack config * Start implementing embed * Implement embed * Add pym types * Add event emitter to Talk Context * Add MatchMedia test for passing values from the context * Add support for click far away * Integrate pym click events to registerClickFarAway * Add tests * Resolve merge issues * Apply PR review
40 lines
935 B
TypeScript
40 lines
935 B
TypeScript
import pym from "pym.js";
|
|
import React from "react";
|
|
import { StatelessComponent } from "react";
|
|
import ReactDOM from "react-dom";
|
|
|
|
import {
|
|
createContext,
|
|
TalkContext,
|
|
TalkContextProvider,
|
|
} from "talk-framework/lib/bootstrap";
|
|
|
|
import { initLocalState } from "./local";
|
|
import localesData from "./locales";
|
|
import AppQuery from "./queries/AppQuery";
|
|
|
|
// This is called when the context is first initialized.
|
|
async function init({ relayEnvironment }: TalkContext) {
|
|
await initLocalState(relayEnvironment);
|
|
}
|
|
|
|
async function main() {
|
|
// Bootstrap our context.
|
|
const context = await createContext({
|
|
init,
|
|
localesData,
|
|
userLocales: navigator.languages,
|
|
pym: new pym.Child({ polling: 100 }),
|
|
});
|
|
|
|
const Index: StatelessComponent = () => (
|
|
<TalkContextProvider value={context}>
|
|
<AppQuery />
|
|
</TalkContextProvider>
|
|
);
|
|
|
|
ReactDOM.render(<Index />, document.getElementById("app"));
|
|
}
|
|
|
|
main();
|