You are reading content from Scuttlebutt
@Hiure %5JvKQfRnuChtnMiarMsmk7Dwtwqc0ogz4C62g4hmjLQ=.sha256

Hi Crabs,

I am with @Luandro Pàtwy and we are trying to do something very simple for the Handshake proposal: P2P Access-Point. Basically we want to use the ssb-core database to save the community portal infos.

Initially for testing purposes we created a vue project from scratch to be able to use the #ssb-browser using in vue-cli. Then we tried using ssb-browser-core as a base, made the bundle from the ssb-setup trying to reproduce what is done in ssb-browser-demo with the ssb-singleton-setup.

When we try to call the SSB module with the getSSBSingleton method in main.js an error occurs in the browser :

Uncaught TypeError: window.getSSBSingleton is not a function.

But if you use the browser console and call the getSSBSingleton function it returns the function.

Another thing is that if you add the line require('ssb-browser-core/ssb-singleton') at the beginning of main.js the error doesn't occur. This seems like strange behavior for the bundle, but we can't identify exactly what is going on.

How do you think we can solve this? @arj @Kyle Maas's Development Thoughts

User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@Hiure %rt5J2z9FvcLpPnp/r9ar5XuMqUDiY5jM7YCt31tyhcM=.sha256

The function is assigned here

@Anders %p62pSp6cCLrF5hxmfQoUWUG/MVrFTOYs1xxt3ajEWC4=.sha256

@Hiure try having a look at https://github.com/arj03/ssb-browser-example. I made a small example to get people started :)

@luandro %8aIhk5Tg58tFpGHfzwwCShwuJHvD4rgz0Ndld5rVeyQ=.sha256

@Dave [ iOS ] seems like it, but strangely enough, we log window before and it shows window.getSSBSingleton.

Thank you @arj!!! Great simple example, worked beautifully on it's own. We're trying to run ssb-browser-core with a traditional Vue setup (vue-cli), which uses webpack, and we're still getting strange errors.

We're simply generating a ssb-browser bundle using browserify, like the example you sent, and loading the bundle thru the index.html. When we load the Vue example app we get this error right off the bat:

Uncaught ReferenceError: windowController is not defined

This is our repo in case u have some time to check it out. I guess having plain html and js, but for the sake of DX, goodies that come with vue-cli are really valuable.

User has not chosen to be hosted publicly
@Hiure %GFPqNH7FUYg7M6qmVLApiOjlPdSD4Su7hvUEiXmkVJY=.sha256

Hi @Dave thanks for your help, its work!!

Thaks @arj for your help whit ssb-browser-example its very useful for us.

@Anders %PvSkY4QOQxJNZIWYRrvVwQaxFkPu7dQQpNszvxQRccQ=.sha256

@Luandro Pàtwy @Hiure it seems there was a bit of activity in the repo and things are working better now?

Also here is a webpack config that I have used to compile browser core so we could test it with rusty wasm validation.

@Hiure %AJdPJdB0lgpCG/A34dMAqOOERSnl29Odn5BiTD2lgxM=.sha256

Yes it worked now, when we change the version to 11.1.0 and used ssb-core-example as a base for the bundle the code got cleaner and we were able to call ssb-browser functions.
The only thing that was still weird was when calling getSSBSingleton, it seems to take a while to load the bundle and we temporarily opted to use a setTimeout in Vue.js. We are still thinking of a better way to do this

Join Scuttlebutt now