A framework that lets you write your entire UI
- as functions
- with React hooks
- without React
- without classes
- without vDOM/DOM diffing
- without web components
- without build step
| <!-- the blur filter makes it look more like a placeholder than a final image --> | |
| <img src="./output.svg" style="width: 1200px; filter: blur(5px)" /> |
| <html lang="en"> | |
| <head> | |
| <script src="https://unpkg.com/[email protected]/min.js"></script> | |
| <script> | |
| const { useState, useEffect } = neverland; | |
| const globalStateManager = (() => { | |
| // "The" global store | |
| let store = {}; | |
| // internal publisher-subscriber system to |
| <html lang="en"> | |
| <head> | |
| <script src="https://unpkg.com/[email protected]/min.js"></script> | |
| </head> | |
| <body> | |
| <div id="app1"></div> | |
| <div id="app2"></div> | |
| <script type="module"> | |
| const { neverland: $, render, html, useState } = neverland; |
A framework that lets you write your entire UI
| // Law of Absurd Reduces: Everything that can be implemented with reduce() will eventually be implemented with reduce() | |
| /** | |
| * @param {Object} chainableFunctions object where each key is the name of a function and it's value is the function itself | |
| */ | |
| const createChainables = (chainableFunctions) => ({ | |
| chain(initialValue) { | |
| const operations = []; | |
| const evaluate = () => operations.reduce( | |
| (value, [func, ...args]) => func(value, ...args), |
| function chain(value) { | |
| return { | |
| /** | |
| * @param {function|string} func function or function name (in chained value) | |
| * @param {...any} args | |
| */ | |
| fn(func, ...args) { | |
| if (typeof func === 'string') { | |
| return chain(value[func](...args)); | |
| } |
| const postAndCancelPrevCall = (() => { | |
| let cancelTokenInstance; | |
| return async (body) => { | |
| try { | |
| if (cancelTokenInstance) { | |
| cancelTokenInstance.cancel('cancelled by user'); | |
| } | |
| cancelTokenInstance = CancelToken.source(); | |
| const axiosResponse = await axios.post(body, { | |
| cancelToken: cancelTokenInstance.token |
| const { isPlainObject } = require('lodash'); | |
| function objectRecursionAndTransformationTemplate(obj) { | |
| if (!obj || !(isPlainObject(obj) || Array.isArray(obj))) { | |
| // put your primitive val transformations here | |
| return obj; | |
| } | |
| if (Array.isArray(obj)) { | |
| // put your array transformations here | |
| return obj.map(objectRecursionAndTransformationTemplate); |
| # exclude node_modules folder and files like .DS_STORE on OSX | |
| rsync -rv --exclude 'node_modules' --exclude '.*' --delete-after --ignore-errors . [email protected]:AppDirectory/ | |
| # execute yarn install | |
| ssh [email protected] 'cd AppDirectory && yarn install' |