Scala.js notifyjs


License

License

Categories

Categories

JavaScript Languages Scala
GroupId

GroupId

com.github.nondeterministic
ArtifactId

ArtifactId

scalajs-notifyjs_sjs1_2.12
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

Scala.js notifyjs
Scala.js notifyjs
Project URL

Project URL

https://github.com/nondeterministic/scalajs-notifyjs
Project Organization

Project Organization

com.github.nondeterministic
Source Code Management

Source Code Management

https://github.com/nondeterministic/scalajs-notifyjs

Download scalajs-notifyjs_sjs1_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.nondeterministic/scalajs-notifyjs_sjs1_2.12/ -->
<dependency>
    <groupId>com.github.nondeterministic</groupId>
    <artifactId>scalajs-notifyjs_sjs1_2.12</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.nondeterministic/scalajs-notifyjs_sjs1_2.12/
implementation 'com.github.nondeterministic:scalajs-notifyjs_sjs1_2.12:0.2.0'
// https://jarcasting.com/artifacts/com.github.nondeterministic/scalajs-notifyjs_sjs1_2.12/
implementation ("com.github.nondeterministic:scalajs-notifyjs_sjs1_2.12:0.2.0")
'com.github.nondeterministic:scalajs-notifyjs_sjs1_2.12:jar:0.2.0'
<dependency org="com.github.nondeterministic" name="scalajs-notifyjs_sjs1_2.12" rev="0.2.0">
  <artifact name="scalajs-notifyjs_sjs1_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.nondeterministic', module='scalajs-notifyjs_sjs1_2.12', version='0.2.0')
)
libraryDependencies += "com.github.nondeterministic" % "scalajs-notifyjs_sjs1_2.12" % "0.2.0"
[com.github.nondeterministic/scalajs-notifyjs_sjs1_2.12 "0.2.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.10
org.scala-js : scalajs-library_2.12 jar 1.1.0
be.doeraene : scalajs-jquery_sjs1_2.12 jar 1.0.0

test (1)

Group / Artifact Type Version
org.scala-js : scalajs-test-bridge_2.12 jar 1.1.0

Project Modules

There are no modules declared in this project.

scalajs-notifyjs

A minimalistic Scala.js type facade for Notify.js supporting both ScalaJS 1.0 and 0.6

Installation

Add the following to your build.sbt:

libraryDependencies += "com.github.nondeterministic" %%% "scalajs-notifyjs" % "0.2.0"

(While the above should also work for Scala 0.6, I haven't tried it myself. You may want to fall back to version 0.1.1 in case of trouble.)

You also must make sure that the project, which you want to use scalajs-notifyjs in, has the corresponding JavaScript libraries available. To this end, you can either include them manually in your .html files, or add the following to your build.sbt:

jsDependencies += "org.webjars" % "jquery"   % "2.2.4" / "2.2.4/jquery.js"
jsDependencies += "org.webjars" % "notifyjs" % "0.4.2" / "0.4.2/notify.js"

Usage

Currently, there are basically three different use cases supported, all of which are demonstrated in the piece of code below.

import org.scalajs.jquery.jQuery
import scalatags.JsDom.all._
import com.github.nondeterministic.notifyjs._

object TutorialApp {
  def main(args: Array[String]): Unit = {
    val myHtml = div(id:="pos-demo", p("Message!"))
    jQuery("body").append(myHtml.render)

    // Some ordinary notifications:
    // Corresponds to the following JavaScript call:
    // $.notify("Warning!", "warn");
    Notify("Warning!", "warn")
    Notify("Error!", "error")
    Notify("Info!", "info")
	  
    // A bit of customisation:
    Notify("I'm a lefty!", new Options { override val globalPosition = "left" })

    // Positioning relative to an HTML-element:
    // Corresponds to the following JavaScript call:
    // $('#pos-demo').notify('Near Message!', { position:'bottom', className:'info', autoHide:false });
    Notify(jQuery("#pos-demo"), 
          "I'm a relativist!", 
          new Options { override val className = "info";
                        override val globalPosition = "bottom";
                        override val autoHide = false})
  }
}

Versions

Version
0.2.0