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
| // File: UseLocalStorageTextInput.tsx | |
| // Author: Mitch Allen | |
| import {ChangeEventHandler, useCallback, useState} from "react"; | |
| export interface LocalStorageTextInput { | |
| storageKey?: string, | |
| id?: string, | |
| name?: string, | |
| label?: string, |
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
| // File: UseTextInput.tsx | |
| // Author: Mitch Allen | |
| import {ChangeEventHandler, useCallback, useState} from "react"; | |
| export interface TextInput { | |
| id?: string, | |
| name?: string, | |
| label?: string, | |
| helperText?: string, |
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
| // File: UsedCheckedInput.tsx | |
| // Author: Mitch Allen | |
| import {ChangeEventHandler, useCallback, useState} from "react"; | |
| export interface CheckedInput { | |
| id?: string, | |
| name?: string, | |
| init?: boolean, | |
| } |
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
| // Add this to the bottom of index.js | |
| let robbie = makeObject(); | |
| robbie.hello(); | |
| let b9 = makeObject({ name: 'B9' }); | |
| b9.hello(); |
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
| // Modify the index.js import command: | |
| import {makeObject, default as obj} from './my-mod.js'; |
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
| // Insert into my-mod.js above default export | |
| export function makeObject(options = {}) { | |
| let { | |
| name = 'Robbie' | |
| } = options; | |
| function hello() { | |
| console.log(`My name is ${name}`); | |
| } |
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
| <html> | |
| <head> | |
| <title>js-module-01</title> | |
| </head> | |
| <body> | |
| <script type="module" src="./index.js"></script> | |
| </body> | |
| </html> |
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
| { | |
| "name":"js-module-01", | |
| "version":"1.0.0", | |
| "description":"", | |
| "type":"module", | |
| "main":"index.js", | |
| "scripts":{ | |
| "test":"echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "keywords":[ |
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
| // File: index.js | |
| // Author: Mitch Allen | |
| import obj from './my-mod.js'; | |
| obj.name = "Droid"; | |
| console.log( "My name is", obj.name ); |
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
| // File: my-mod.js | |
| // Author: Mitch Allen | |
| export default {} |