scalajs-jquery3-compat


License

License

Categories

Categories

JavaScript Languages Scala Net
GroupId

GroupId

net.exoego
ArtifactId

ArtifactId

scalajs-jquery3-compat_sjs0.6_2.11
Last Version

Last Version

2.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

scalajs-jquery3-compat
scalajs-jquery3-compat
Project URL

Project URL

https://github.com/exoego/scala-js-jquery
Project Organization

Project Organization

net.exoego
Source Code Management

Source Code Management

https://github.com/exoego/scala-js-jquery

Download scalajs-jquery3-compat_sjs0.6_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/net.exoego/scalajs-jquery3-compat_sjs0.6_2.11/ -->
<dependency>
    <groupId>net.exoego</groupId>
    <artifactId>scalajs-jquery3-compat_sjs0.6_2.11</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.exoego/scalajs-jquery3-compat_sjs0.6_2.11/
implementation 'net.exoego:scalajs-jquery3-compat_sjs0.6_2.11:2.1.0'
// https://jarcasting.com/artifacts/net.exoego/scalajs-jquery3-compat_sjs0.6_2.11/
implementation ("net.exoego:scalajs-jquery3-compat_sjs0.6_2.11:2.1.0")
'net.exoego:scalajs-jquery3-compat_sjs0.6_2.11:jar:2.1.0'
<dependency org="net.exoego" name="scalajs-jquery3-compat_sjs0.6_2.11" rev="2.1.0">
  <artifact name="scalajs-jquery3-compat_sjs0.6_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.exoego', module='scalajs-jquery3-compat_sjs0.6_2.11', version='2.1.0')
)
libraryDependencies += "net.exoego" % "scalajs-jquery3-compat_sjs0.6_2.11" % "2.1.0"
[net.exoego/scalajs-jquery3-compat_sjs0.6_2.11 "2.1.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
net.exoego : scalajs-jquery3_sjs0.6_2.11 jar 2.1.0
org.scala-js : scalajs-library_2.11 jar 0.6.33
org.scala-js : scalajs-dom_sjs0.6_2.11 jar 1.0.0

test (1)

Group / Artifact Type Version
org.scala-js : scalajs-test-bridge_2.11 jar 0.6.33

Project Modules

There are no modules declared in this project.

scala-js-jquery

Static types for the jQuery API for Scala.js programs.

This library is a fork of sjrd/scala-js-jquery to maintain for newer Scala.js and jQuery.

Usage

For jQuery 3 (recommended)

Currently, jQuery 3.5.1 is supported.

Add the following to your sbt build definition:

libraryDependencies += "net.exoego" %%% "scalajs-jquery3" % "2.1.0"

Enjoy types in Scala file:

import net.exoego.scalajs.jquery._

jQuery("button".on("click", () => println("hello world"))

This aritifcat is built and published for

It will likely be published as is for later versions of Scala and Scala.js as well.

For jQuery 3 in org.scalajs.jquery package

This artifact provides type aliases as bridge from the original package org.scalajs.jquery to the updated net.exoego.scalajs.jquery package.

It will allow you to update type facade to jQuery 3 with minimum code change. But you should expect some minor rewrites, since

  • Original org.scalajs.jquery offers non strict types for jQuery 1/2.
  • net.exoego.scalajs.jquery offers stricter types are for jQuery 3.

Add the following to your sbt build definition:

libraryDependencies += "net.exoego" %%% "scalajs-jquery3-compat" % "2.1.0"

You may use type aliases in org.scalajs.jquery:

import org.scalajs.jquery._

jQuery("button".on("click", () => println("hello world"))

For jQuery 1/2

*** jQuery 1/2 support was removed. Consider upgrading to jQuery 3/4 or remove jQuery. ***

This is a drop-in replacement for original "be.doeraene" %%% "scalajs-jquery" % "0.9.5" artifact.

Caution: Sources of scalajs-jquery2 are just copy of sjrd/scala-js-jquery and published for newer Scala.js & Scala. The actual supported jQuery version is unknown. It is unlikely to update type facade for this artifact by me (contribution are welcome).

Add the following to your sbt build definition:

libraryDependencies += "net.exoego" %%% "scalajs-jquery2" % "2.0.0" // Final version. Consider upgrading to jQuery 3/4 or remove jQuery. 

Enjoy types in Scala file:

import org.scalajs.jquery._

jQuery("button".on("click", () => println("hello world"))

then enjoy the types available in org.scalajs.jquery.

This aritifcat is built and published for Scala.js 0.6.29 and later, and Scala.js 1.0.0, with Scala 2.11, 2.12, 2.13. It will likely be published as is for later versions of Scala and Scala.js as well.

Using Scala.js Bundler

If you want to use Scala.js Bundler (sbt plugin must be enabled in project/plugins.sbt) to import jQuery as npm module, then add the following lines to your sbt build definition:

enablePlugins(ScalaJSBundlerPlugin)

libraryDependencies += "net.exoego" %%% "scalajs-jquery3" % "2.1.0"

npmDependencies in Compile ++= Seq(
  "jquery" -> "3.5.0"
)

Then define a jquery object in your Scala code using the @JSImport annotation to get access to the exported jQuery object. A simple example on how to use the Scala.js JQuery facade this way is shown here:

import net.exoego.scalajs.jquery.{ JQueryStatic => jquery }

object Main {
  override def main(): Unit = {
    jquery("body").html("Hello world!")
  }
}

Running the sbt task fastOptJS::webpack will generate a JavaScript bundle (...-fastopt-bundle.js) including jquery as specified in the npmDependencies sbt build definition setting.

Versions

Version
2.1.0
2.0.0
1,0,0
1.0.0
0.9.6