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 fetchResult = commandFactory<Item>(async ({ path, payload }) => { | |
| const response = await fetch(payload.value); | |
| const result = await response.json(); | |
| return [replace(path("result"), JSON.stringify(result, undefined, 2))]; | |
| }); |
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 fetchItems = commandFactory<Item>(async ({ path }) => { | |
| const response = await fetch("https://swapi.co/api/"); | |
| const json = await response.json(); | |
| const items: Item[] = Object.keys(json).map(key => { | |
| return { | |
| label: key, | |
| value: json[key] | |
| }; | |
| }); | |
| return [replace(path("items"), items)]; |
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 { | |
| createProcess, | |
| createCommandFactory | |
| } from "@dojo/framework/stores/process"; | |
| import { replace } from "@dojo/framework/stores/state/operations"; | |
| import { State, Item } from "../interfaces"; | |
| // commandFactory typed to my application state | |
| const commandFactory = createCommandFactory<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
| import { tsx } from "@dojo/framework/widget-core/tsx"; | |
| import { WidgetBase } from "@dojo/framework/widget-core/WidgetBase"; | |
| import { watch } from "@dojo/framework/widget-core/decorators/watch"; | |
| import Listbox from "@dojo/widgets/listbox"; | |
| import TextArea from "@dojo/widgets/text-area"; | |
| import theme from "@dojo/themes/dojo"; | |
| import * as css from "./styles/APIExplorer.m.css"; | |
| import { ExplorerProperties, Item } from "../interfaces"; |
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 default class Map extends WidgetBase<MapProperties> { | |
| onAttach() { | |
| const element = this.meta(HtmlMeta).get("elemRef") as HTMLElement; | |
| this.properties.initializeMap(element); | |
| } | |
| protected render() { | |
| return <div classes={css.root} key="elemRef" />; | |
| } | |
| } |
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
| initializeMap = async (container: HTMLElement) => { | |
| loadCss('https://js.arcgis.com/4.10/esri/css/main.css'); | |
| const [MapView, WebMap] = await loadModules(['esri/views/MapView', 'esri/WebMap']); | |
| // then we load a web map from an id | |
| const webmap = new WebMap({ | |
| portalItem: { | |
| id: this.webmapid | |
| } | |
| }); | |
| // and we show that map in a container w/ id #viewDiv |
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
| { | |
| "build-app": { | |
| "build-time-render": { | |
| "root": "root", | |
| "paths": [ | |
| "#home", | |
| "#about", | |
| "#profile" | |
| ] | |
| } |
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
| <!DOCTYPE html> | |
| <html lang="en-us"> | |
| <head> | |
| <title>dojo-btr</title> | |
| <meta name="theme-color" content="#222127"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| </head> | |
| <body> | |
| <div id="root"></div> <!-- Add this element --> | |
| </body> |
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
| // src/widgets/SearchInput.tsx | |
| ... | |
| export class SearchInput extends WidgetBase<SearchInputProperties> { | |
| @watch() private searchValue = ""; | |
| private onChange(value) { | |
| if (!value) { | |
| return; | |
| } | |
| this.searchValue = value; | |
| const { handleChange } = this.properties; |
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
| // src/widgets/EmojiResultsRow.tsx | |
| import { tsx } from "@dojo/framework/widget-core/tsx"; | |
| import { WidgetBase } from "@dojo/framework/widget-core/WidgetBase"; | |
| import * as css from "./styles/EmojiResultsRow.m.css"; | |
| import ElementMeta from "./ElementMeta"; | |
| import * as Clipboard from "clipboard"; | |
| export interface EmojiResultsRowProperties { | |
| title: string; | |
| symbol: string; | |
| } |