Hogosuru is a framework to easily write a complete single page application in Go or just export some functionnality directly accessible in javascript (functionnality that need speed for example).
A detailed documentation with code examples can be found here : https://hogosuru.v-ip.fr/
He use an addon syscall/js (that catch error) and implement a large part of the major features of javascript directly accessible in go.
For a list of functionnality , see the array of compatibility below or check the name of directory that match the API MDN implementation: https://developer.mozilla.org/fr/docs/Web/API
Each object is herited from a baseobject.BaseObject. The baseobject keep a true JS object reference.
All structure available can interact with this object and use the internal functionnality of each object.
If an error occur , this error is handle and return by each function.
Just import the lib in your project (hogosuru no need use an extended rewrite of base syscall)
GOOS=js GOARCH=wasm go get github.com/realPy/hogosuru
The project work with Go and Tinygo compiler. Use Go compiler for developpement (faster) and tinygo for production
The autodiscover is a special function.
When a function receives a data which is global object (exemple with the attribute data of an event) or which is not an expected data, it is possible to ask hogosuru to guess the content of the object and to create the corresponding Go object.
This is not magic, and it only works if the type of object has already been seen before (hogosuru keeps in memory the type of objects and their constructor).
It would be possible to register all the objects known to hogosuru but that would amount to integrating the whole implementation in your binary.
When you use an object (by use it or cast it) , the constructor is loaded automatically.
If the type is not known, autodiscover will return an object of type BaseObject
Some structure like nodelist or document can be used with chaining capabilities (function that return one object that will be used immediatly without check error).It's a shortcut that ignores errors. The functions which allow this functionality are by convention with the same prototype, with the same name but which end with "_". It is a convention created for hogosuru. All the functions available in chaining are contained in the "chaining.go" file at the root of each component
This is a young project and there are a lot of work to do
All help is welcome. If you are interested by this project, please contact me
https://github.com/realPy/hogosurutoaster
https://github.com/realPy/hogosurupagination
https://github.com/realPy/hogosurudatatable
All help is welcome. If you are interested by this project, please contact me.