This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createHashRouter, DataStrategyFunction, DataStrategyResult, Outlet, RouterProvider } from "react-router-dom"; | |
import { createRoot } from "react-dom/client"; | |
// global user state management | |
abstract class User { | |
static token: string | null = 'expired token' | |
static async refreshToken(): Promise<boolean> { | |
await new Promise((resolve) => setTimeout(resolve, 1000)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
void handler1(dynamic eventData) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
class BadThrottler { | |
/// default action to be called when the throttler is called without a action | |
final FutureOr<void> Function()? defaultAction; | |
bool _running = false; | |
BadThrottler({this.defaultAction}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
class BadDebouncer { | |
final Duration delay; | |
/// default action to be called when the debouncer is called without a action | |
final void Function()? defaultAction; | |
Timer? _timer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NumExt on num { | |
String readableFixed([int fractionDigits = 1]) { | |
final absVal = abs(); | |
String raw = ''; | |
String unit = ''; | |
switch (absVal) { | |
case < 1e3: | |
raw = toStringAsFixed(fractionDigits); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
ext.kotlin_version = '1.5.20' | |
repositories { | |
// google() | |
// mavenCentral() | |
maven{ url 'https://maven.aliyun.com/repository/central' } | |
maven{ url 'https://maven.aliyun.com/repository/public' } | |
maven{ url 'https://maven.aliyun.com/repository/google' } | |
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin' } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install 之后先使用 | |
// serve-with-gojs/build-with-gojs | |
// 对 node_module 中相关的文件进行处理 | |
// 去除开源版本的 gojs 自带的水印 | |
const fs = require('fs') | |
const path = require('path') | |
const file_js = path.join(__dirname, './node_modules/gojs/release/go.js') | |
const file_mjs = path.join(__dirname, './node_modules/gojs/release/go.mjs') | |
const file_module = path.join(__dirname, './node_modules/gojs/release/go-module.js') |