Closed lyricsdev closed 5 months ago
try using the latest @infernus/cef@^0.1.0
with the polyfill of cef available in infernus-starter.
can you specifically post the code of emitEvent? discord: dockfries2233
my deps:
Here is my test code :
<!doctype html>
<html>
<body>
<div>
<button id="test">hello</button>
<div id="test2">hello1</div>
</div>
<script>
const btn = document.getElementById("test");
const content = document.getElementById("test2");
cef.on("loginpage:response", (success) => {
if (success) {
content.innerText = JSON.stringify(Object.keys(cef));
cef.set_focus(false);
return;
}
});
btn.addEventListener("click", () => {
cef.emit("loginpage:login", "somepassword");
});
</script>
</body>
</html>
import { defineEvent } from '@infernus/core'
import { Cef, CefEvent } from '@infernus/cef'
CefEvent.onInitialize(({ player, success, next }) => {
if (!player)
return next()
if (success) {
new Cef({
player,
browserId: 1,
url: 'http://localhost:5500/index.html', // i use vscode live server extension start the index.html
hidden: false,
focused: true,
})
}
else {
player.sendClientMessage(
-1,
'Ahh to bad you cannot see our new cool interface ...',
)
}
return next()
})
CefEvent.onBrowserCreated(({ cef, statusCode }) => {
if (cef.browserId === 1) {
if (statusCode !== 200) {
// fallback to dialogs ...
return
}
Cef.subscribe('loginpage:login', 'OnLogin')
}
})
const [onPlayerCefLogin] = defineEvent({
name: 'OnPlayerCefLogin',
identifier: 'is',
beforeEach(playerId: number, password: string) {
return { playerId, password }
},
})
onPlayerCefLogin(({ playerId, password, next }) => {
console.log(playerId, password)
Cef.emitEvent(playerId, 'loginpage:response', 1)
return next()
})
#include <open.mp>
#include <samp-node>
#include <streamer>
#include <cef>
#include <polyfill/i18n>
#include <polyfill/cef>
main(){}
forward OnLogin(player_id, const arguments[]);
public OnLogin(player_id, const arguments[]) {
return SAMPNode_CallEvent("OnPlayerCefLogin", player_id, arguments);
}
recreated a project with 0.1.0 semp cef Now it works but so stange. it shows me only when i press and only after when i going to window mode and back example some times it works and showing in Tab but sometimes itsnt and i wanted to ask you about something, if i will use a libraries like prisma orm or something like that it should work?
This is really strange. The case I provide is always shown. Have you tried to develop your current cef code by pawn? I think it may be a problem at the sa client level.
The orm library like prisma is not fully supported by samp-node at present. I have tried to use typeorm, and I almost always encounter blocking terminal execution every time I start, which is strange, but press enter, but this is obviously not suitable for actual production environments.
For orm libraries that you can try to import, you will most likely find that when you just import the library and try to initialize it, you will encounter terminal blocking.
The blocking problem is not caused by infernus and needs to be solved by samp-node authors.
yep i tried it works normally :D, so i can provide to u a zip file with that to test by your self, maybe its trouble in my client? cef 1.4.1
Sure, I used 1.4.1 too
can i have your discord or telegram to provide? or for you will be easyli to get invited to repo?
discord: dockfries2233
hey bro i have a problem with that when i'm trying to emit event to show player a ui server giving that
[dev:server] [2024-05-26T00:19:34+0300] [Info] [sampgdk:w] Invalid buffer size
can i have your discord to show problem properly? didnt find any yours contacts p.s on calling eventits getting [dev:server] [2024-05-26T01:53:36+0300] [Info] [sampgdk:w] Invalid buffer size but if we are calling like in docs samp-cef it works(pawn)