@18ys/god 中文文档教程
What is God?
god是一个全局的target,可以给它设置一些数据,解决vue3没有全局的vue。
Installation
Node.js
$ npm install @18ys/god
Module
umd
Usage
import { give, ask, clean } from '@18ys/god';
// for example: set axios instance to god
// give one time at a file with js
let instance = axios.createInstance();
give('axios', instance, { readonly: true });
// use Infinity times at any file with js
let axiosInstance = ask('axios');
axiosInstance.get('http://example.com/getData').then(..)
// when you couldn't use some keys, clean it.
clean('axios');
ask('axios'); // null
Api
import god from '@18ys/god';
// 1. set
god.give(key: string, value: any, options?: { readonly?: boolean });
// readonly default is false, when you set readonly as true, the key is can't be cleaned
// 2. get
god.ask(key: string) // return (value: any | null)
// 3. remove
god.clean(key: string)
What is God?
God is a global target, you can set some data to it, to resolve that vue3 don't have the global Vue.
Installation
Node.js
$ npm install @18ys/god
Module
umd
Usage
import { give, ask, clean } from '@18ys/god';
// for example: set axios instance to god
// give one time at a file with js
let instance = axios.createInstance();
give('axios', instance, { readonly: true });
// use Infinity times at any file with js
let axiosInstance = ask('axios');
axiosInstance.get('http://example.com/getData').then(..)
// when you couldn't use some keys, clean it.
clean('axios');
ask('axios'); // null
Api
import god from '@18ys/god';
// 1. set
god.give(key: string, value: any, options?: { readonly?: boolean });
// readonly default is false, when you set readonly as true, the key is can't be cleaned
// 2. get
god.ask(key: string) // return (value: any | null)
// 3. remove
god.clean(key: string)
更多
你可能也喜欢
- 7480_math_example 中文文档教程
- @0xproject/order-utils 中文文档教程
- @0xsequence/erc20-meta-token 中文文档教程
- @10stars/eslint-plugin-react-hooks 中文文档教程
- @10up/react-focus-trap-hoc 中文文档教程
- @36node/template-sdk 中文文档教程
- @3beeepb/react-native-keyboard-dismiss 中文文档教程
- @3kles/kles-crud-service 中文文档教程
- @8base/table-schema-provider 中文文档教程
- @a417420427/use-mouse-state 中文文档教程