GitHub - gopherjs/jquery: GopherJS Bindings for jQuery | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

gopherjs/jquery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Bindings for GopherJS

Install

$ go get github.com/gopherjs/jquery

How To Use

welcome.html file:

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Welcome to GopherJS with jQuery</title>
    <script src="resources/jquery-2.1.0.js"></script>
</head>
<body>
    <input id="name" type="text" value="" placeholder="What is your name ?" autofocus/>
    <span id="output"></span>
    <script src="welcome.js"></script>
</body>
</html>

welcome.go file:

package main

import "github.com/gopherjs/jquery"

//convenience:
var jQuery = jquery.NewJQuery

const (
	INPUT  = "input#name"
	OUTPUT = "span#output"
)

func main() {

	//show jQuery Version on console:
	print("Your current jQuery version is: " + jQuery().Jquery)

	//catch keyup events on input#name element:
	jQuery(INPUT).On(jquery.KEYUP, func(e jquery.Event) {

		name := jQuery(e.Target).Val()
		name = jquery.Trim(name)

		//show welcome message:
		if len(name) > 0 {
			jQuery(OUTPUT).SetText("Welcome to GopherJS, " + name + " !")
		} else {
			jQuery(OUTPUT).Empty()
		}
	})
}

Compile welcome.go:

$ gopherjs build welcome.go

Tests

In the "tests" folder are QUnit Tests, run the server with:

"go run server.go" and open a browser: http://localhost:3000

The relevant QUnit Test cases are defined in the test/index.go file.

Sample Apps ported from Javascript/Coffeescript to GopherJS

Look at the Sample Apps to find out what is working and how. Any feedback is welcome !

Status

The normal DOM / Ajax / Deferreds Api is done and can be considered stable. Please look up the index.go file in the test folder to see how it works.

About

GopherJS Bindings for jQuery

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 11

Languages

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.