本文整理汇总了Scala中scala.scalajs.js.annotation.JSName类的典型用法代码示例。如果您正苦于以下问题:Scala JSName类的具体用法?Scala JSName怎么用?Scala JSName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: LZString
//设置package包名称以及导入依赖的类
package slate.bindings
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
import scala.scalajs.js.typedarray.Uint8Array
@js.native
@JSName("LZString")
object LZString extends js.Any {
@js.native
def compressToUint8Array(str: String): Uint8Array = js.native
@js.native
def decompressFromUint8Array(buf: Uint8Array): String = js.native
@js.native
def compressToUTF16(str: String): String = js.native
@js.native
def decompressFromUTF16(str: String): String = js.native
@js.native
def compress(str: String): String = js.native
@js.native
def decompress(str: String): String = js.native
}
示例2: GetAuthTokenOptions
//设置package包名称以及导入依赖的类
package slate
package chrome
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSName, ScalaJSDefined}
import scala.scalajs.js.{UndefOr, native, undefined}
@ScalaJSDefined
class GetAuthTokenOptions(val interactive: UndefOr[Boolean] = undefined,
val account: UndefOr[AccountInfo] = undefined,
val scopes: UndefOr[js.Array[String]] = undefined) extends js.Object
@ScalaJSDefined
class LaunchWebAuthFlowOptions(val url: String,
val interactive: UndefOr[Boolean] = undefined) extends js.Object
@ScalaJSDefined
class RemoveCachedAuthTokenOptions(val token: String) extends js.Object
@ScalaJSDefined
class AccountInfo(val id: String) extends js.Object
@native
@JSName("chrome.identity")
object ChromeIdentity extends js.Object {
@JSName("getAuthToken")
@native
def fetchAuthToken(details: UndefOr[GetAuthTokenOptions] = undefined,
callback: js.Function1[String, Unit]): Unit = native
@native
def launchWebAuthFlow(details: LaunchWebAuthFlowOptions,
callback: js.Function1[String, Unit]): Unit = native
@native
def removeCachedAuthToken(details: RemoveCachedAuthTokenOptions,
callback: js.Function1[Unit, Unit]): Unit = native
}
@ScalaJSDefined
class LastError(val message: UndefOr[String]) extends js.Object
@native
@JSName("chrome.runtime")
object ChromeRuntime extends js.Object {
@native
def lastError: UndefOr[LastError] = native
}
示例3: Moment
//设置package包名称以及导入依赖的类
package com.momentjs
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
@js.native
@JSName("moment")
object Moment extends js.Object {
def apply(millis: Double): Date = js.native
def locale(localeName: String): Unit = js.native
def defineLocale(localeName: String, settings: js.Dictionary[js.Any]): Unit = js.native
}
@js.native
trait Date extends js.Object {
def fromNow(): String = js.native
def fromNow(withoutSuffix: Boolean): String = js.native
def from(millis: Double, withoutSuffix: Boolean): String = js.native
def format(stringFormat: String): String = js.native
}
示例4: KaTex
//设置package包名称以及导入依赖的类
package codes.mark.geilematte.facades
import org.scalajs.dom
import scala.scalajs.js
import scala.scalajs.js.JavaScriptException
import scala.scalajs.js.annotation.JSName
@JSName("katex")
@js.native
object KaTex extends js.Object {
def render(latex: String, target: dom.Element, config:js.Object = new KaTexConfig(true)): Unit = js.native
}
@js.native
class KaTexConfig(var displayMode:Boolean) extends js.Object
object SafeKaTex {
def render(latex: String, target: dom.Element): Option[String] =
try {
KaTex.render(latex, target)
Option.empty
} catch {
case (e: JavaScriptException) =>
Option(e.getMessage)
}
}
示例5: MarkedRenderer
//设置package包名称以及导入依赖的类
package com.karasiq.markedjs
import scala.scalajs.js
import scala.scalajs.js.UndefOr
import scala.scalajs.js.annotation.JSName
//noinspection SpellCheckingInspection
@js.native
@JSName("marked.Renderer")
class MarkedRenderer extends js.Object {
// Block level renderer methods
def code(code: String, language: String): String = js.native
def blockquote(quote: String): String = js.native
def html(html: String): String = js.native
def heading(text: String, level: Int): String = js.native
def hr(): String = js.native
def list(body: String, ordered: Boolean): String = js.native
def listitem(text: String): String = js.native
def paragraph(text: String): String = js.native
def table(header: String, body: String): String = js.native
def tablerow(content: String): String = js.native
def tablecell(content: String, flags: js.Object): String = js.native
// Inline level renderer methods
def strong(text: String): String = js.native
def em(text: String): String = js.native
def codespan(code: String): String = js.native
def br(): String = js.native
def del(text: String): String = js.native
def link(href: String, title: String, text: String): String = js.native
def image(href: String, title: String, text: String): String = js.native
}
object MarkedRenderer {
def apply(code: UndefOr[(String, String) ? String] = js.undefined, blockquote: UndefOr[String ? String] = js.undefined, html: UndefOr[String ? String] = js.undefined, heading: UndefOr[(String, Int) ? String] = js.undefined, hr: UndefOr[() ? String] = js.undefined, list: UndefOr[(String, Boolean) ? String] = js.undefined, listitem: UndefOr[String ? String] = js.undefined, paragraph: UndefOr[String ? String] = js.undefined, table: UndefOr[(String, String) ? String] = js.undefined, tablerow: UndefOr[String ? String] = js.undefined, tablecell: UndefOr[(String, js.Object) ? String] = js.undefined, strong: UndefOr[String ? String] = js.undefined, em: UndefOr[String ? String] = js.undefined, codespan: UndefOr[String ? String] = js.undefined, br: UndefOr[() ? String] = js.undefined, del: UndefOr[String ? String] = js.undefined, link: UndefOr[(String, String, String) ? String] = js.undefined, image: UndefOr[(String, String, String) ? String] = js.undefined): MarkedRenderer = {
val renderer = new MarkedRenderer().asInstanceOf[js.Dynamic]
code.foreach(renderer.code = _)
blockquote.foreach(renderer.blockquote = _)
html.foreach(renderer.html = _)
heading.foreach(renderer.heading = _)
hr.foreach(renderer.hr = _)
list.foreach(renderer.list = _)
listitem.foreach(renderer.listitem = _)
paragraph.foreach(renderer.paragraph = _)
table.foreach(renderer.table = _)
tablerow.foreach(renderer.tablerow = _)
tablecell.foreach(renderer.tablecell = _)
strong.foreach(renderer.strong = _)
em.foreach(renderer.em = _)
codespan.foreach(renderer.codespan = _)
br.foreach(renderer.br = _)
del.foreach(renderer.del = _)
link.foreach(renderer.link = _)
image.foreach(renderer.image = _)
renderer.asInstanceOf[MarkedRenderer]
}
}
示例6: TabOverride
//设置package包名称以及导入依赖的类
package com.karasiq.taboverridejs
import org.scalajs.dom
import org.scalajs.dom.Element
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
@js.native
@JSName("tabOverride")
object TabOverride extends TabOverride
@js.native
trait TabOverride extends js.Object {
def set(textArea: dom.html.TextArea): Unit = js.native
def tabSize(size: Int = ???): Int = js.native
def autoIndent(value: Boolean = ???): Boolean = js.native
def tabKey(key: Int = ???, mod: js.Array[String] = ???): Int = js.native
def addExtension(hook: String, function: js.Function): Unit = js.native
def delay(delay: Int = ???): Int = js.native
def escape(escape: Boolean = ???): Boolean = js.native
def style: TabOverrideStyle = js.native
}
@js.native
trait TabOverrideStyle extends js.Object {
def apply(enabled: Boolean = ???): Boolean = js.native
def enabledClass(cls: String = ???): String = js.native
def activeClass(cls: String = ???): String = js.native
def hardTabSize(tab: Int = ???): Int = js.native
def utils: TabOverrideStyleUtils = js.native
}
@js.native
trait TabOverrideStyleUtils extends js.Object {
def hardTabSizeSupported: Boolean = js.native
def addEnabledClass(e: Element): Unit = js.native
def addActiveClass(e: Element): Unit = js.native
def removeEnabledClass(e: Element): Unit = js.native
def removeActiveClass(e: Element): Unit = js.native
def updateEnabledClass(cls: String = ???): Unit = js.native
def updateActiveClass(cls: String = ???): Unit = js.native
def addTabSizeCSSSelector(cls: String = ???): Unit = js.native
def removeTabSizeCSSSelector(cls: String = ???): Unit = js.native
}
示例7: JQueryStatic
//设置package包名称以及导入依赖的类
package spatutorial.client.components
import org.scalajs.dom._
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
@js.native
trait JQueryEventObject extends Event {
var data: js.Any = js.native
}
@js.native
@JSName("jQuery")
object JQueryStatic extends js.Object {
def apply(element: Element): JQuery = js.native
}
@js.native
trait JQuery extends js.Object {
def on(events: String, selector: js.Any, data: js.Any, handler: js.Function1[JQueryEventObject, js.Any]): JQuery = js.native
def off(events: String): JQuery = js.native
}
示例8: VNode
//设置package包名称以及导入依赖的类
package scalatags.hokko.raw
import org.scalajs.dom
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
import scalatags.hokko.raw.VirtualDom.VTreeChild
@JSName("virtualDom.VNode")
@js.native
class VNode[T](tagName0: String,
properties0: js.UndefOr[js.Dictionary[js.Any]] = js.undefined,
children0: js.UndefOr[js.Array[VTreeChild[_ <: dom.Node]]] =
js.undefined)
extends js.Object
with VTreeChild[T] {
def tagName: String = js.native
def key: js.UndefOr[String] = js.native
def namespace: js.UndefOr[String] = js.native
def count: Int = js.native
def hasWidgets: Boolean = js.native
def hasThunks: Boolean = js.native
def hooks: js.UndefOr[js.Dictionary[js.Any]] = js.native
def children: js.Array[VTreeChild[_]] = js.native
def properties: js.Dictionary[js.Any] = js.native
}
示例9: VirtualDom
//设置package包名称以及导入依赖的类
package scalatags.hokko.raw
import org.scalajs.dom
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
@JSName("virtualDom")
@js.native
object VirtualDom extends js.Object {
def create[T](node: VTreeChild[T],
opts: js.UndefOr[js.Object] = js.undefined): T =
js.native
def diff[T](lhs: VTreeChild[T], rhs: VTreeChild[T]): Patch = js.native
def patch(rootNode: dom.raw.Node, patches: Patch): dom.raw.Element =
js.native
@js.native
trait VTreeChild[+T] extends js.Any
@js.native
trait Patch extends js.Object
}
示例10: AceEditor
//设置package包名称以及导入依赖的类
package spatutorial.client.components
import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}
import macros.JSMacro
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
import scala.scalajs.js.{UndefOr, _}
@js.native
@JSName("ReactAce")
object AceEditor extends js.Object
case class AceEditorGenerated(mode : UndefOr[String] = undefined,
theme : UndefOr[String] = undefined,
name : UndefOr[String] = undefined,
height : UndefOr[String] = undefined,
fontSize: UndefOr[Int] = undefined,
value: UndefOr[String] = undefined
) {
def toJS = {
val p = js.Dynamic.literal()
mode.foreach(v => p.updateDynamic("mode")(v))
theme.foreach(v => p.updateDynamic("theme")(v))
name.foreach(v => p.updateDynamic("name")(v))
height.foreach(v => p.updateDynamic("height")(v))
fontSize.foreach(v => p.updateDynamic("fontSize")(v))
value.foreach(v => p.updateDynamic("value")(v))
p
}
def apply(children: js.UndefOr[ReactNode] = js.undefined) = {
val props = JSMacro[AceEditorGenerated](this)
val f = React.asInstanceOf[js.Dynamic].createFactory(AceEditor)
f(props, children).asInstanceOf[ReactComponentU_]
}
}
示例11: propOne
//设置package包名称以及导入依赖的类
package spatutorial.client.components
import japgolly.scalajs.react.vdom.prefix_<^.<
import japgolly.scalajs.react.{BackendScope, Callback, JsComponentM, JsComponentType, JsComponentU, ReactComponentB, ReactComponentU_, ReactNode}
import org.scalajs.dom.raw.HTMLElement
import scala.scalajs.js
import scala.scalajs.js._
import scala.scalajs.js.annotation.JSName
@js.native
trait SampleReactComponentProps extends js.Object {
def propOne: String = js.native
def propRwo: String = js.native
}
@js.native
@JSName("SampleReactComponent")
class SampleReactComponent(props: SampleReactComponentProps) extends JsComponentU[SampleReactComponentProps, js.Object, HTMLElement]
object SampleReactComponentProps {
def apply(propOne: String,
propTwo: String): SampleReactComponentProps = {
js.Dynamic.literal(
propOne = propOne,
propYwo = propTwo
).asInstanceOf[SampleReactComponentProps]
}
}
object SampleReactComponent {
// ,^.style("width: 500; height: 500")
val component = ReactComponentB[SampleReactComponentProps]("SampleReactComponent")
.render_P(p => new SampleReactComponent(p))
.build
// val component = ReactComponentB[AceProps]("AceEditor")
// //.render(p => new AceEditor(p))
// .render_P(p => new AceEditor(p))
// .build
def apply(props: SampleReactComponentProps, children: ReactNode*) = component(props, children: _*)
def apply() = component
}
示例12: JQueryStatic
//设置package包名称以及导入依赖的类
package ch.fhnw.ima.saav
package view
import org.scalajs.dom._
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
@js.native
trait JQueryEventObject extends Event {
var data: js.Any = js.native
}
@js.native
@JSName("jQuery")
object JQueryStatic extends js.Object {
def apply(element: Element): JQuery = js.native
}
@js.native
trait JQuery extends js.Object {
def on(events: String, selector: js.Any, data: js.Any, handler: js.Function1[JQueryEventObject, js.Any]): JQuery = js.native
def off(events: String): JQuery = js.native
}
示例13: JQueryStatic
//设置package包名称以及导入依赖的类
package drt.client.components
import org.scalajs.dom._
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSImport, JSName}
@js.native
trait JQueryEventObject extends Event {
var data: js.Any = js.native
}
@js.native
//@JSName("wtf")
@JSImport("expose-loader?jQuery!jquery", JSImport.Namespace)
object JQueryStatic extends js.Object {
def apply(element: Element): JQuery = js.native
}
@js.native
trait JQuery extends js.Object {
def on(events: String, selector: js.Any, data: js.Any, handler: js.Function1[JQueryEventObject, js.Any]): JQuery = js.native
def off(events: String): JQuery = js.native
}
示例14: JQueryStatic
//设置package包名称以及导入依赖的类
package console.components
import org.scalajs.dom._
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
@js.native
trait JQueryEventObject extends Event {
var data: js.Any = js.native
}
@js.native
@JSName("jQuery")
object JQueryStatic extends js.Object {
def apply(element: Element): JQuery = js.native
}
@js.native
trait JQuery extends js.Object {
def on(events: String, selector: js.Any, data: js.Any, handler: js.Function1[JQueryEventObject, js.Any]): JQuery = js.native
def off(events: String): JQuery = js.native
}
示例15: Commands
//设置package包名称以及导入依赖的类
package io.surfkit.clientlib.wysihtml5
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
//https://github.com/Voog/wysihtml/blob/master/src/commands.js
@JSName("wysihtml.Commands")
@js.native
class Commands extends js.Object{
def support(command: String):Boolean = js.native
def exec(command: String, value: js.Any*): js.Any = js.native
def remove(command: String, value: js.Any*): js.Any = js.native
def state(command: String, value: js.Any*): js.Any = js.native
def stateValue(value: js.Any): js.Any = js.native
}