This is a small library for extending HTMLElement methods.
Returns the first descendant of the element which matches the given selector. This is identical to Element.querySelector().
<HTMLElement> HTMLElement.descendant(<String> selector)
| --[[ | |
| clockworksquirrel.iif | |
| Returns a given value based on whether the condition evaluates to true or false. | |
| Usage: | |
| <variant> IIF(<boolean> expression, <variant> value_if_true, <variant> value_if_false) | |
| --]] | |
| return function(Condition, IfTrue, IfFalse) | |
| if (not not Condition) then return IfTrue end |
| --[[ | |
| clockworksquirrel.const | |
| Emulates "Constants" by locking a given table to a metatable. | |
| Also adds functions to retrieve the table's keys, values, and entries. | |
| Usage: <table> const(<table> table) | |
| --]] | |
| local t = require(script.Parent.t) |
| --[[ | |
| clockworksquirrel.extend-tree | |
| Extends game tree-traversal methods. | |
| Available methods - | |
| Miscellaneous: | |
| <boolean> HasProperty, <variant> Value :HasProperty(<Instance> Object, <string> Property) | |
| Returns true if an Instance has the specified property, along with the value | |
| of the property. |
This is a small library for extending HTMLElement methods.
Returns the first descendant of the element which matches the given selector. This is identical to Element.querySelector().
<HTMLElement> HTMLElement.descendant(<String> selector)
| import React, { useLayoutEffect, useState, useCallback } from 'react'; | |
| import clsx from 'clsx'; | |
| import { ThemeProvider, createMuiTheme } from '@material-ui/core/styles'; | |
| import { Paper, makeStyles } from '@material-ui/core'; | |
| const useStyles = makeStyles(theme => ({ | |
| pseudoBody: { | |
| width: '100vw', | |
| height: '100vh', |
| class RobloxUnit { | |
| constructor(value = new String) { | |
| if (typeof(value) === 'number') value = `${value}s`; | |
| if (typeof(value) !== 'string') throw new Error('Value must be a string with format [number][unit]; e.g. 20s'); | |
| console.info(`Got "${value}"`); | |
| const __ov = value; | |
| value = __ov.replace(/[A-Za-z"']+/gi, ''); | |
| let unit = __ov.replace(/[^A-Za-z"']+/gi, ''); |
| -- clockworksquirrel.instance-encode | |
| local dump = {} | |
| local http = game:GetService("HttpService") | |
| local response = http:RequestAsync({ | |
| Url = "https://raw.githubusercontent.com/ClockworkSquirrel/roblox-client-dump/master/API-Dump-Tree.json" | |
| }) | |
| dump = http:JSONDecode(response.Body) |
| local function timeToDegrees(hours, minutes, inRadians) | |
| hours = type(hours) == "number" and hours or 0 | |
| minutes = type(minutes) == "number" and minutes or 0 | |
| local timeDegrees = { | |
| hours = (hours / 12) * 360, | |
| minutes = (minutes / 60) * 360 | |
| } | |
| if (inRadians) then |
| local Polyfill = {}; do | |
| function Polyfill.new(base) | |
| local Poly; Poly = setmetatable({}, { | |
| __index = function(self, key) | |
| if (Poly[key]) then | |
| return Poly[key] | |
| end | |
| return base[key] | |
| end |