Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Emit raw JS code from .go (for wrapping existing JS libs) #4

Open
coopernurse opened this issue Jan 4, 2013 · 3 comments
Open

Emit raw JS code from .go (for wrapping existing JS libs) #4

coopernurse opened this issue Jan 4, 2013 · 3 comments

Comments

@coopernurse
Copy link

Thanks for this project. Quick question: is there a way to tell go2js to emit some raw JS code from within a .go file?

If not, how do you recommend writing wrappers for existing JS libraries? For example, I'd like to wrap a library like jQuery and encapsulate the Go->JS bindings in a single place. Then I can call the wrapped Go version in a type safe manner.

Thoughts?

@tredoe
Copy link
Owner

tredoe commented Jan 5, 2013

What do you mean about "to emit raw JS code from .go"?
go2js translates Go (almost all specification, by now) to JS

@coopernurse
Copy link
Author

I'm basically looking for a FFI from Go to JS. I want to wrap some existing JS libraries.

It looks like this could be done without modifying the translator much and could probably be done as a separate project.

I saw a thread on golang-nuts about this project and there was some talk that supporting a FFI was not part of the project goals. Is that true? If so then I can spin up a new github project and keep it separate.

Thanks

@tredoe
Copy link
Owner

tredoe commented Jan 6, 2013

Personally, I would prefer to avoid such tool because so people could create libraries in Go for JS, instead of to use actual JS libraries.

But well, if it's built by somebody then it can be added to go2js; I've no problem by that side. I'm trying don't be so dogmatic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants