From 6e0f7c0a66117ea458c61bf18c4a721d90523448 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 25 Aug 2023 08:13:21 +0530 Subject: docs: readme --- docs/api/functions.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 docs/api/functions.md (limited to 'docs/api/functions.md') diff --git a/docs/api/functions.md b/docs/api/functions.md new file mode 100644 index 0000000..39f85cb --- /dev/null +++ b/docs/api/functions.md @@ -0,0 +1,91 @@ +# Functions + +```typescript +type custom-property-name = `--${string}` +type selector = string // Any css selector or identifier (used as id) +type condition = string // empty string, 0, 'false', "'false'" and "\"false\"" are all false, the rest are fine. Don't ask. +type duration = number | `${number}ms` | `${number}s` +``` + +## get-var +Get css custom property from an element + +NOTE: Avoid using `var` inside cssx expressions. + +```typescript +function get-var(custom-property-name): string +function get-var(selector, custom-property-name): string +``` + +## update +Update a css custom property on an element + +```typescript +function update(custom-property-name, string): void +function update(selector, custom-property-name, string): string +``` + + +## js-eval +Evaluate any js expression. Easy escape hatch into writing the worst code humanly possible. + +```typescript +function js-eval(string): string +``` + + +## if +If expression. You know how this one goes. If truthy, it'll pick the second argument, else the third. + +```typescript +function if(condition, any, any): any +``` + + +## delay +Wait a bit. + +```typescript +function delay(duration): void +``` + +Examples for input - +- `delay(100)`: wait for 100 milliseconds +- `delay(100ms)`: wait for 100 milliseconds +- `delay(5s)`: wait for 5 seconds +- `delay(0.5s)`: wait for 500 milliseconds + + +## load-cssx + + +## set-attr + + +## attr + + +## prevent-default + + +## request + + +## add-children + + +## remove-element + + +## call-method + + +## map + + +## call + + +## func + + -- cgit v1.3.1