diff --git a/Docs-%40-0.1.0.md b/Docs%400.2.0.md similarity index 68% rename from Docs-%40-0.1.0.md rename to Docs%400.2.0.md index 5f457df..3070c83 100644 --- a/Docs-%40-0.1.0.md +++ b/Docs%400.2.0.md @@ -1,19 +1,21 @@ -> RageFW and it's documentation is still in early development and may contain come unclear explanations. It you find any of those please open an issue and describe you problem or any improvemenets you want to see +> Rage FW and it's documentation are still in early development and may contain come unclear explanations. It you find any of those please open an issue and describe you problem or any improvements you want to see + +# Rage Framework @ 0.2.0 RageFW distibutes under a list of packages: -- ``rage-fw-server`` [npmjs.com](https://www.npmjs.com/package/rage-fw-server) -- ``rage-fw-client`` [npmjs.com](https://www.npmjs.com/package/rage-fw-client) -- ``rage-fw-cef`` [npmjs.com](https://www.npmjs.com/package/rage-fw-cef) -- ``rage-fw-shared-types`` [npmjs.com](https://www.npmjs.com/package/rage-fw-shared-types) +- ``@entityseven/rage-fw-server`` [npmjs.com](https://www.npmjs.com/package/@entityseven/rage-fw-server) +- ``@entityseven/rage-fw-client`` [npmjs.com](https://www.npmjs.com/package/@entityseven/rage-fw-client) +- ``@entityseven/rage-fw-cef`` [npmjs.com](https://www.npmjs.com/package/@entityseven/rage-fw-browser) +- ``@entityseven/rage-fw-shared-types`` [npmjs.com](https://www.npmjs.com/package/@entityseven/rage-fw-shared-types) -These are setup as-should if you are using our CLI, if you still want to setup yourself, please refer to [example](https://git.entityseven.com/entityseven/rage-framework-example) +These are setup as-should if you are using our CLI, if you still want to setup yourself, please refer to [examples](https://git.entityseven.com/entityseven/rage-framework-example) ## Shared types Core element of type-safety in our framework system. It allows you to manually type any **custom** events you have in your server system. There are three interfaces, which share between the system to apply types: - ``RageFW_ICustomClientEvent`` - ``RageFW_ICustomServerEvent`` -- ``RageFW_ICustomCefEvent`` +- ``RageFW_ICustomBrowserEvent`` To apply types for events we use the following system and below is a sample how it applies them your code @@ -21,9 +23,9 @@ To apply types for events we use the following system and below is a sample how customEventName(arg1: string, arg2: number): boolean ``` ```ts -register('customEventName', (arg1 /*string*/, arg2 /*number*/) => { +register('customEventName', async (arg1 /*string*/, arg2 /*number*/) => { // your logic -return true /*boolean*/ +return true /*Promise*/ }) ``` @@ -32,9 +34,9 @@ Package used on a server-side of your Rage:MP Server ### Usage ```ts -import { fw } from 'rage-fw-server' +import { fw } from '@entityseven/rage-fw-server' ``` -Only usable in server environment. For usage in Client and CEF refer to their docs +Only usable in server environment. For usage in [Client](#client) and [Browser](#browser) refer to their sections ### Declaration ```ts @@ -43,10 +45,11 @@ fw = { player: Player, system: { log: Logger - } + }, + rpc: Rpc } ``` -Further documentation will describe the functions included in ``fw`` +Further documentation will describe the fields included in ``fw`` ### Server Handles event manipulations that do not require player to be present in context @@ -59,15 +62,6 @@ fw.event.register('serverEventName', ([arg1, arg2]) => { }) ``` -#### registerMany -Registers more than one server event at a time -```ts -fw.event.registerMany({ - serverEventName1: ([arg1, arg2]) => { /* your logic here */} - serverEventName2: ([arg1, arg2]) => { /* your logic here */} -}) -``` - #### unregister Unregisters server event ```ts @@ -124,22 +118,22 @@ Package used on a client-side of your Rage:MP Server ### Usage ```ts -import { fw } from 'rage-fw-client' +import { fw } from '@entityseven/rage-fw-client' ``` -Only usable in client environment. For usage in Server and CEF refer to their docs +Only usable in client environment. For usage in [Server](#server) and [Browser](#browser) refer to their docs ### Declaration ```ts fw = { event: Client, player: Player, - browser: Browser, system: { - log: Logger - } + log: Logger, + }, + rpc: Rpc, } ``` -Further documentation will describe the functions included in ``fw`` +Further documentation will describe the fields included in ``fw`` ### Client Handles event manipulations that do not require player to be present in context @@ -211,22 +205,23 @@ Error logs. Colored in red fw.system.log.info('error message') ``` -## CEF -Package used on a frontend-side of your Rage:MP Server +## Browser +Package used on a browser-side of your Rage:MP Server ### Usage ```ts -import { fw } from 'rage-fw-cef' +import { fw } from '@entityseven/rage-fw-browser' ``` -Only usable in CEF environment. For usage in Server and Client refer to their docs +Only usable in CEF environment. For usage in [Server](#server) and [Client](#client) refer to their docs ### Declaration ```ts fw = { - event: Cef, + event: Browser, + rpc: Rpc } ``` -Further documentation will describe the functions included in ``fw`` +Further documentation will describe the fields included in ``fw`` ### Cef @@ -254,4 +249,8 @@ fw.event.triggerServer('serverEventName', ['arg1', 2]) Triggers registered client event with passed arguments. Formerly known as ``trigger`` ```ts fw.event.triggerClient('clientEventName', ['arg1', 2]) -``` \ No newline at end of file +``` + +## Features +### Event Middlewares +todo \ No newline at end of file