Skip to content

Commit

Permalink
feat: client api wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuyk committed May 16, 2024
1 parent c4a7d5a commit 7b39cc6
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 17 deletions.
59 changes: 42 additions & 17 deletions src/main/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
import * as alt from 'alt-client';
import '../translate/index.js';
import './startup.js';
import { useClientApi } from './api/index.js';

// Load all other files after translate
import './controllers/index.js';
import './rmlui/index.js';
import './screen/index.js';
import './system/index.js';
import './virtualEntities/index.js';
import { useWebview } from './webview/index.js';
import { useClientInteraction } from './controllers/interaction.js';

async function start() {
useWebview();
import { getInput } from './menus/native/input.js';
import { useNativeMenu } from './menus/native/index.js';

// Load Plugins
alt.log(':: Loading Client Plugins');
import('./plugins.js');
alt.log(':: Loaded Client Plugins');
}
import { useClonedPed } from './ped/clone.js';

import { useCamera } from './player/camera.js';

import * as math from './utility/math/index.js';
import * as text from './utility/text/index.js';

start();
import { useWebview } from './webview/index.js';

export function useRebarClient() {
return {
useClientApi,
controllers: {
interaction: {
useClientInteraction,
},
},
menus: {
useNativeMenu,
input: {
getInput,
},
},
ped: {
useClonedPed,
},
player: {
useCamera,
},
utility: {
math,
text,
},
webview: {
useWebview,
},
};
}
21 changes: 21 additions & 0 deletions src/main/client/startup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as alt from 'alt-client';
import '../translate/index.js';

// Load all other files after translate
import './controllers/index.js';
import './rmlui/index.js';
import './screen/index.js';
import './system/index.js';
import './virtualEntities/index.js';
import { useWebview } from './webview/index.js';

async function start() {
useWebview();

// Load Plugins
alt.log(':: Loading Client Plugins');
import('./plugins.js');
alt.log(':: Loaded Client Plugins');
}

start();

0 comments on commit 7b39cc6

Please sign in to comment.