Skip to content

Instantly share code, notes, and snippets.

@rturevic-mm
rturevic-mm / stateful.js
Created October 27, 2025 16:43
Basic Vue State
import Vue from 'vue';
const store = new Map();
export function useState(key, initialValue = null) {
if (!store.has(key)) {
store.set(key, Vue.observable({ value: initialValue }));
}
return store.get(key);
}
<?
public static function timelog($message = '', $context = '', $clear = false)
{
$filePath = 'timelog.log';
if (!isset($GLOBALS['timelog']) || $clear) {
file_put_contents($filePath, "");
$GLOBALS['timelog'] = 1;
self::$contextLastTime[$context] = null;
}