Package Protocol: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
When referencing to other files in client_packages, you use '''package://'''
The root of this protocol is the client_packages folder.


For example, a file located in '''client_packages\index.html''' can be referred to with <code>package://index.html</code> 
{{JSContainer|
A file located in '''client_packages\my-resource\index.html''' can be referred to with <code>package://my-resource/index.html</code>
You can also require json files with it <code>package://my-resource/beasts.json</code>, so it'll be <code>const beasts = require('package://my-resource/beasts.json')</code>


*'''NOTE''': JSON Require only works in '''CEF'''.
==Summary==
<code>http://package/</code> is the protocol for the root folder of `client_packages`, allowing easy access to files client-side.
 
When referencing files in `client_packages`, use <pre>http://package/</pre>. Examples:
* A file in `client_packages\index.html` can be accessed as <pre>http://package/index.html</pre>.
* A JSON file in `client_packages\my-resource\beasts.json` can be required as <pre>const beasts = require('http://package/my-resource/beasts.json');</pre>.
 
==Package2==
<pre>http://package2/</pre> functions similarly, caching resources for faster access. Works if CEF files are in `client_packages/package2`.
}}

Latest revision as of 16:53, 8 November 2024

JavaScript Syntax


Summary

http://package/ is the protocol for the root folder of `client_packages`, allowing easy access to files client-side.

When referencing files in `client_packages`, use
http://package/
. Examples:
  • A file in `client_packages\index.html` can be accessed as
    http://package/index.html
    .
  • A JSON file in `client_packages\my-resource\beasts.json` can be required as
    const beasts = require('http://package/my-resource/beasts.json');
    .

Package2

http://package2/
functions similarly, caching resources for faster access. Works if CEF files are in `client_packages/package2`.