@cybermp-community/browser-types 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CyberMP Community Developers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # CyberMP Browser Types
2
+ > By [CyberMP Community Developers](https://gitlab.com/cybermp).
3
+
4
+ This repository contains the TypeScript type definitions for the **[CyberMP](https://cyber.mp) user interface (CEF)** environment, providing comprehensive type safety for creating the game's UI in a browser context.
5
+
6
+ These types allow for robust communication between the UI and the client, as well as access to any browser-side APIs provided by the CyberMP mod.
7
+
8
+ ## 📦 Installation
9
+
10
+ ### 1. Install Package
11
+
12
+ Using NPM:
13
+
14
+ ```bash
15
+ npm install -D @cybermp-community/browser-types
16
+ ```
17
+
18
+ Using PNPM:
19
+
20
+ ```bash
21
+ pnpm install -D @cybermp-community/browser-types
22
+ ```
23
+
24
+ Using Bun:
25
+
26
+ ```bash
27
+ bun add -d @cybermp-community/browser-types
28
+ ```
29
+
30
+ ### 2. Set types in tsconfig.json
31
+
32
+ ```json
33
+ {
34
+ "compilerOptions": {
35
+ "types": [
36
+ "@cybermp-community/browser-types"
37
+ ]
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## ⚖️ License
43
+
44
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@cybermp-community/browser-types",
3
+ "version": "1.0.0",
4
+ "description": "TypeScript type definitions for the CyberMP browser environment (CEF).",
5
+ "main": "src/index.d.ts",
6
+ "files": [
7
+ "src/index.d.ts"
8
+ ],
9
+ "repository": {
10
+ "type": "gitlab",
11
+ "url": "https://gitlab.com/cybermp/types/browser"
12
+ },
13
+ "scripts": {
14
+ "bump": "npm version patch --no-git-tag-version",
15
+ "pub": "npm publish --access public"
16
+ },
17
+ "keywords": [
18
+ "cybermp",
19
+ "cyberpunk",
20
+ "multiplayer",
21
+ "mp",
22
+ "browser",
23
+ "cef",
24
+ "cp2077",
25
+ "types"
26
+ ],
27
+ "author": "An1by",
28
+ "license": "MIT",
29
+ "contributors": [
30
+ "terminaate"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
35
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ export interface MpEvents {
2
+ /**
3
+ * Used for listening for events coming from client-side.
4
+ * @param eventName Name of the event to listen for.
5
+ * @param callback Function to execute when the event is triggered.
6
+ */
7
+ on(eventName: string, callback: (...args: any[]) => void): void;
8
+
9
+ /**
10
+ * Removes a previously registered event listener.
11
+ * @param eventName Name of the event.
12
+ * @param func Callback function to remove.
13
+ */
14
+ off(eventName: string, func: (...args: any[]) => void): void;
15
+
16
+ /**
17
+ * Triggers an event on client-side.
18
+ * @param eventName Name of the event to trigger.
19
+ * @param args Arguments to send with the event.
20
+ */
21
+ emit(eventName: string, ...args: any[]): void;
22
+ }
23
+
24
+ export interface MpBrowser {
25
+ events: MpEvents;
26
+ }
27
+
28
+ export const mp: MpBrowser;