@permitio/permit-js
Version:
Permitio is a frontend package that makes it easy to use permit abilities
29 lines (20 loc) • 621 B
text/typescript
import { PermitElements } from "./elements";
import { Elements } from "./types";
import { Proxy } from "./proxy";
class Permit {
elements: Elements;
proxy: Proxy;
constructor() {
this.elements = new PermitElements();
this.proxy = new Proxy();
}
}
const permit_init = () => {
if (typeof window === 'undefined') {
console.warn("Running Permit outside of a browser environment. \nConsider using permitio node package or importing only the parts you need");
return new Permit();
}
else
return window._permit || (window._permit = new Permit());
}
export const permit = permit_init();