So writing md in the app without the option of seeing a preview?
However, it seems very slow on save/re-edit. If you save, click done, to see the preview and then click edit it says it's still saving it and it takes quite a while.
| <!doctype html> | |
| <html lang=en> | |
| <head> | |
| <meta charset=utf-8> | |
| <title>Web audio API</title> | |
| <style> | |
| </style> | |
| </head> | |
| <body> | |
| <button id="play-btn" style="display:none;">play/pause</button> |
| async function Alert(msg) { | |
| await (msg => { | |
| return Promise.resolve(alert(msg)) | |
| })(msg) | |
| // things you want to do after the alert OK-button is clicked | |
| } | |
| Alert('Take your time…') |
| function typeOf (value) { | |
| return Object.prototype.toString.call(value) | |
| .replace(/^\[object\s+([a-z]+)\]$/i, '$1') | |
| .toLowerCase(); | |
| } |
| /** | |
| * Description: Remove properties from an object based on a filter | |
| * @param {object} obj The object to filter out elements from | |
| * @param {[string]|object} filter The array, or object to use as filter | |
| * @param {boolean} filterIsKey (default true) wether the filter is referring to the key or the value | |
| * @param {boolean} inclusive (default true) wether the filter is what we want to keep, or what we want to remove | |
| * @returns {object} A new filtered object | |
| */ | |
| function objectFilter (obj, filter, filterIsKey = true, inclusive = true) { | |
| return Array.isArray(filter) |
| /** | |
| * Description | |
| * @param {Array} list | |
| * @param {string} key | |
| * @returns {any} | |
| */ | |
| export const groupBy = (list, key) => { | |
| return ( | |
| list?.reduce((acc, row) => { | |
| // acc = {}, row[key] = exv 'SITE' (key='listType') acc.SITE är undefined från början, men propen skapas iom exp=exp och sätts till [] eftersom acc[row[key]] är undefined. Nästa varv finns propen med arrayen med en rad i. |
| /** | |
| * Description Plockar ut URL-parametrar som ett objekt plus andra godsaker. | |
| * @param {string} href | |
| * @returns {Object} {...allParams, href:getterFunction, baseUrl:URL, params:URLSearchParams} | |
| */ | |
| function getParams(href) { | |
| const baseUrl = new URL(href) | |
| var paramSeparator = baseUrl.hash.startsWith('#') ? '#' : '?' | |
| var params = baseUrl.hash.startsWith('#') ? new URLSearchParams(baseUrl.hash.slice(1)) : new URLSearchParams(baseUrl.search) | |
| const obj = { baseUrl, get href() { return this.baseUrl.origin + this.baseUrl.pathname + paramSeparator + this.params.toString() }, params } |
| /** | |
| * Description | |
| * @param {Object} obj | |
| * @param {function} keyFilter | |
| * @param {function} valueFilter | |
| * @returns {Object} | |
| */ | |
| const objectFilter = (obj, keyFilter, valueFilter) => { | |
| let array = Object.entries(obj) // [ [key, value], [key, value] ] | |
| if (typeof keyFilter === 'function') { |
| /** | |
| * Description Splits out all keys from an object and returns them as separate objects with single key/value pairs | |
| * @param {Object} obj | |
| * @returns {Array} | |
| */ | |
| function ArrayFromObject(obj) { | |
| return Object.entries(obj).map(([v,k])=>({[v]:k})) | |
| } |
| /** | |
| * Description | |
| * @param {any} value | |
| * @returns {string} | |
| */ | |
| function typeOf(value) { | |
| return Object.prototype.toString | |
| .call(value) | |
| .replace(/^\[object\s+([a-z]+)\]$/i, '$1') | |
| .toLowerCase() |