
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@web-lite/api-types
Advanced tools
typescript interfaces and types for W api object
Yarn
yarn add @web-lite/api-types --dev
npm
npm install @web-lite/api-types --save-dev
typescript
import IWindow from '@web-lite/api-types';
const W = (window as IWindow).W;
javascript
Webstorm Webstorm indexing will find and use the type for W, no additioanl setup is needed
VSCode
Add a reference to the typed file at heading when you want to use W
APIs. VSCode will use its intellisense to suggest docs and auto-complete.
/// <reference path="node_modules/@web-lite/api-types/index.d.ts" />
Note:
You may need to change the path ofnode_modules
directory in workspace-configured projects.
Note: You can still use mocks.api
import { mockWebliteApi } from '@web-lite/api-types';
mockWebliteApi();
// or
mockWebliteApi({ user: { firstname: 'custom_name', id: 'custom_id' } });
export interface IMock {
config: {
debug: boolean;
timing: {
initializeAsync: number;
getProfile: number;
shareDB: number;
user: number;
chat: number;
message: number;
};
storage: 'localStorage' | 'sessionStorage';
};
__profile__: Record<string, any>;
profile: {
school?: {};
};
__users__: Record<string, Omit<IMock['user'], 'getInfo'>>;
user: {
id: string;
firstname: string;
lastname?: string;
username: string;
profileImage?: string;
bio?: string;
getInfo: () => Omit<IMock['user'], 'getInfo'>;
};
__wapps__: {
wisId?: string;
wappId: string;
mode: RunningWappMode;
};
wapps: {
inputs?: Record<string, any>;
admins?: string[];
};
__chat__: Record<string, ChatInfo>;
__db__: {};
}
This will only set window.W
in development.
process.env.NODE_ENV === 'development' && !window.W
v1.3.0 (2021-09-19)
FAQs
Use W with type checking and mock out of the box.
The npm package @web-lite/api-types receives a total of 2 weekly downloads. As such, @web-lite/api-types popularity was classified as not popular.
We found that @web-lite/api-types demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.