当前位置: 首页>>代码示例>>Scala>>正文


Scala JSName类代码示例

本文整理汇总了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
} 
开发者ID:edmundnoble,项目名称:slate,代码行数:28,代码来源:LZString.scala

示例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
} 
开发者ID:edmundnoble,项目名称:slate,代码行数:49,代码来源:ChromeIdentity.scala

示例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
} 
开发者ID:walfie,项目名称:gbf-raidfinder,代码行数:22,代码来源:package.scala

示例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)
    }
} 
开发者ID:i-am-the-slime,项目名称:geilematte,代码行数:28,代码来源:KaTex.scala

示例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]
  }
} 
开发者ID:Karasiq,项目名称:scalajs-marked,代码行数:60,代码来源:MarkedRenderer.scala

示例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
} 
开发者ID:Karasiq,项目名称:scalajs-marked,代码行数:48,代码来源:TabOverride.scala

示例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
} 
开发者ID:mistakenot,项目名称:scalajstemp,代码行数:25,代码来源:JQuery.scala

示例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
} 
开发者ID:tzbob,项目名称:scalatags-hokko,代码行数:27,代码来源:VNode.scala

示例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
} 
开发者ID:tzbob,项目名称:scalatags-hokko,代码行数:26,代码来源:VirtualDom.scala

示例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_]
  }
} 
开发者ID:wrotki,项目名称:spacommander,代码行数:39,代码来源:AceEditorGenerated.scala

示例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

} 
开发者ID:wrotki,项目名称:spacommander,代码行数:48,代码来源:SampleReactComponent.scala

示例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
} 
开发者ID:fhnw-saav,项目名称:saav,代码行数:26,代码来源:jQuery.scala

示例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
} 
开发者ID:UKHomeOffice,项目名称:drt-scalajs-spa-exploration,代码行数:26,代码来源:JQuery.scala

示例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
} 
开发者ID:haghard,项目名称:akka-cluster-console,代码行数:25,代码来源:JQuery.scala

示例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
} 
开发者ID:coreyauger,项目名称:scala-js-wysihtml,代码行数:18,代码来源:Commands.scala


注:本文中的scala.scalajs.js.annotation.JSName类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。