本文整理汇总了Scala中scala.scalajs.js.annotation.JSImport类的典型用法代码示例。如果您正苦于以下问题:Scala JSImport类的具体用法?Scala JSImport怎么用?Scala JSImport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSImport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。
示例1: React
//设置package包名称以及导入依赖的类
package io.taig.react4s.mui.facade
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
@js.native
@JSImport( "react", JSImport.Namespace )
object React extends js.Object {
def createClass( specification: js.Dictionary[js.Any] ): js.Dynamic =
js.native
def createElement(
element: js.Any,
props: js.Dictionary[js.Any] = null,
children: js.Any = null
): js.Dynamic = js.native
}
开发者ID:Taig,项目名称:react4s-mui,代码行数:18,代码来源:React.scala
示例2: apply
//设置package包名称以及导入依赖的类
package io.scalajs.npm.brake
import io.scalajs.RawOptions
import io.scalajs.nodejs.stream.{Readable, Writable}
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSImport, ScalaJSDefined}
import scala.scalajs.js.|
/**
* brake - throttle a stream with backpressure
* @see https://www.npmjs.com/package/brake
* @author [email protected]
*/
@js.native
trait Brake extends js.Object {
/**
* Return a transform stream b that applies backpressure when more data than the rate allows is written.
* @param rate the throttle rate
* @param options the throttle options
* @return a [[Readable]] / [[Writable]] instance
*/
def apply(rate: Double, options: ThrottleOptions | RawOptions = js.native): Readable with Writable = js.native
}
/**
* Brake Singleton
* @author [email protected]
*/
@js.native
@JSImport("brake", JSImport.Namespace)
object Brake extends Brake
/**
* Throttle Options
* @param rate How many bytes to emit for each interval of length period
* @param period How often to check the output length in milliseconds. Default value: 1000.
*/
@ScalaJSDefined
class ThrottleOptions(var rate: js.UndefOr[Double] = js.undefined,
var period: js.UndefOr[Int] = js.undefined) extends js.Object
开发者ID:scalajs-io,项目名称:brake,代码行数:44,代码来源:Brake.scala
示例3: uuid
//设置package包名称以及导入依赖的类
package de.mukis.js
import scala.annotation.meta.field
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.annotation.{JSExport, JSImport}
import scala.scalajs.js.|
@JSImport("node-uuid/uuid", Namespace)
@js.native
object uuid extends UUID
@js.native
trait UUID extends js.Object {
def v1(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native
def v1(
options: UUIDOptions,
buffer: js.Array[Double],
offset: js.UndefOr[Double]
): js.Array[Double] = js.native
def v4(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native
def v4(
options: UUIDOptions,
buffer: js.Array[Double],
offset: js.UndefOr[Double]
): js.Array[Double] = js.native
def parse(
id: String,
buffer: js.UndefOr[js.Array[Double]] = js.undefined,
offset: js.UndefOr[Double] = js.undefined
): js.Array[Double] = js.native
def unparse(
buffer: js.Array[Double],
offset: js.UndefOr[Double] = js.undefined
): String = js.native
}
case class UUIDOptions(
@(JSExport @field) node: js.UndefOr[js.Array[js.Any]] = js.undefined,
@(JSExport @field) clockseq: js.UndefOr[Double] = js.undefined,
@(JSExport @field) msecs: js.UndefOr[Double | js.Date] = js.undefined,
@(JSExport @field) nsecs: js.UndefOr[Double] = js.undefined
)
开发者ID:muuki88,项目名称:scala-target-examples,代码行数:51,代码来源:uuid.scala
示例4: 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
示例5: JpegJs
//设置package包名称以及导入依赖的类
package org.bruchez.tessel
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.typedarray.Uint8Array
import scala.scalajs.js.|
@js.native
@JSImport("jpeg-js", JSImport.Namespace)
object JpegJs extends js.Object {
def decode(buffer: Buffer, asUint8Array: Boolean = false): JpegJsResult = js.native
}
@js.native
trait JpegJsResult extends js.Object {
val width : Int = js.native
val height : Int = js.native
val data : Uint8Array | Buffer = js.native
}
开发者ID:ebruchez,项目名称:tessel-display,代码行数:22,代码来源:JpegJs.scala
示例6: HeaderBtn
//设置package包名称以及导入依赖的类
package weatherApp.components
import japgolly.scalajs.react.ScalaFnComponent
import japgolly.scalajs.react.vdom.html_<^._
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
object HeaderBtn {
@JSImport("../../assets/images/github.png", JSImport.Namespace)
@js.native
object GithubLogo extends js.Any
case class Props(text: String, url: String, isLogin: Boolean = false)
val Component = ScalaFnComponent[Props](props => {
val icon = if (props.isLogin) <.img(^.width := 25.px, ^.marginRight := 5.px, ^.src := GithubLogo.asInstanceOf[String])
else <.div()
<.div(
^.display := "flex",
^.justifyContent := "flex-end",
<.a(
^.cls := "header-btn",
^.display := "flex",
^.justifyContent := "center",
^.alignItems := "center",
^.border := "1px solid black",
^.borderRadius := 3.px,
^.padding := 5.px,
^.textDecoration := "none",
^.href := props.url,
icon,
props.text
)
)
})
def apply(props: Props) = {
GithubLogo
Component(props)
}
}
开发者ID:malaman,项目名称:scala-weather-app,代码行数:44,代码来源:HeaderBtn.scala
示例7: MapMarker
//设置package包名称以及导入依赖的类
package weatherApp.components
import scala.scalajs.js
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.html_<^._
import scala.scalajs.js.annotation.JSImport
object MapMarker {
@JSImport("../../assets/images/marker.png", JSImport.Namespace)
@js.native
object MarkerImage extends js.Any
val Component = ScalaFnComponent[js.Dynamic](props => {
<.div(
^.title := "Map Marker",
<.img(
^.width := 60.px,
^.src := MarkerImage.asInstanceOf[String]
)
)
})
def apply(props: js.Dynamic) = {
MarkerImage
Component(props)
}
}
开发者ID:malaman,项目名称:scala-weather-app,代码行数:31,代码来源:MapMarker.scala
示例8: uuid
//设置package包名称以及导入依赖的类
package net.gutefrage
import scala.annotation.meta.field
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.annotation.{JSExport, JSImport}
import scala.scalajs.js.|
@JSImport("node-uuid/uuid", Namespace)
@js.native
object uuid extends UUID
@js.native
trait UUID extends js.Object {
def v1(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native
def v1(
options: UUIDOptions,
buffer: js.Array[Double],
offset: js.UndefOr[Double]
): js.Array[Double] = js.native
def v4(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native
def v4(
options: UUIDOptions,
buffer: js.Array[Double],
offset: js.UndefOr[Double]
): js.Array[Double] = js.native
def parse(
id: String,
buffer: js.UndefOr[js.Array[Double]] = js.undefined,
offset: js.UndefOr[Double] = js.undefined
): js.Array[Double] = js.native
def unparse(
buffer: js.Array[Double],
offset: js.UndefOr[Double] = js.undefined
): String = js.native
}
case class UUIDOptions(
@(JSExport @field) node: js.UndefOr[js.Array[js.Any]] = js.undefined,
@(JSExport @field) clockseq: js.UndefOr[Double] = js.undefined,
@(JSExport @field) msecs: js.UndefOr[Double | js.Date] = js.undefined,
@(JSExport @field) nsecs: js.UndefOr[Double] = js.undefined
)
开发者ID:muuki88,项目名称:node-scalajs,代码行数:51,代码来源:uuid.scala
示例9: PeerId
//设置package包名称以及导入依赖的类
package eu.devtty.peerid
import io.scalajs.nodejs.buffer.Buffer
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
@js.native
@JSImport("peer-id", JSImport.Namespace)
class PeerId extends js.Object {
def toHexString: String = js.native
def toBytes: Buffer = js.native
def toB58String: String = js.native
def toJSON: PeerIdObject = js.native
def toPrint: PeerIdObject = js.native
def inEqual(id: PeerId): Boolean = js.native
def inEqual(id: Buffer): Boolean = js.native
}
@js.native
trait PeerIdObject extends js.Object {
val privKey: String = js.native
}
开发者ID:magik6k,项目名称:scalajs-ipfs-api,代码行数:27,代码来源:PeerId.scala
示例10: stat
//设置package包名称以及导入依赖的类
package eu.devtty.ipfs
import eu.devtty.cid.CID
import io.scalajs.nodejs.buffer.Buffer
import scala.concurrent.Future
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
trait BlockApi {
def stat(cid: Buffer): Future[BlockStat]
}
@js.native
trait BlockStat extends js.Object {
val key: String = js.native
val size: Int = js.native //Long appears to be broken by scalajs, may need some deeper lok
}
@js.native
@JSImport("ipfs-block", JSImport.Namespace)
class Block(val data: Buffer, val cid: CID) extends js.Object
@js.native
@JSImport("ipfs-block", JSImport.Namespace)
object Block extends js.Object {
def isBlock(other: js.Any): Boolean = js.native
}
开发者ID:magik6k,项目名称:scalajs-ipfs-api,代码行数:30,代码来源:BlockApi.scala
示例11: PeerInfo
//设置package包名称以及导入依赖的类
package eu.devtty.peerinfo
import eu.devtty.multiaddr.Multiaddr
import eu.devtty.peerid.PeerId
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
@js.native
@JSImport("peer-info", JSImport.Namespace)
object PeerInfo extends js.Object {
def create(id: PeerId, callBack: js.Function1[PeerInfo, _]): Unit = js.native
def create(callBack: js.Function1[PeerInfo, _]): Unit = js.native
}
@js.native
@JSImport("peer-info", JSImport.Namespace)
class PeerInfo(id: PeerId) extends js.Object {
val multiaddrs: MultiaddrSet = js.native
def connect(ma: Multiaddr): Unit = js.native
def disconnect(): Unit = js.native
def isConnected: Boolean = js.native
}
@js.native
trait MultiaddrSet extends js.Object {
def replace(existing: Multiaddr, fresh: Multiaddr): Unit = js.native
}
开发者ID:magik6k,项目名称:scalajs-ipfs-api,代码行数:31,代码来源:PeerInfo.scala
示例12: MultiHash
//设置package包名称以及导入依赖的类
package eu.devtty.multihash
import io.scalajs.nodejs.buffer.Buffer
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
@js.native
@JSImport("multihashes", JSImport.Namespace)
object MultiHash extends js.Object {
def validate(multihash: Buffer): Unit = js.native
}
@js.native
trait DecodedMultiHash extends js.Object {
val code: Int = js.native
val name: String = js.native
val length: Int = js.native
val digest: Buffer = js.native
}
开发者ID:magik6k,项目名称:scalajs-ipfs-api,代码行数:23,代码来源:Multihash.scala
示例13: snabbdom
//设置package包名称以及导入依赖的类
package snabbdom
import org.scalajs.dom.{Element, Text}
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.|
@JSImport("snabbdom", Namespace)
@js.native
object snabbdom extends js.Object {
def init(modules: js.Array[js.Object]): js.Function2[VNode | Element, VNode, VNode] = js.native
}
@JSImport("snabbdom/h", Namespace)
@js.native
object h extends js.Function3[String, js.UndefOr[js.Any], js.UndefOr[js.Any], VNode] {
def apply(selector: String, b: js.UndefOr[js.Any] = js.undefined, c: js.UndefOr[js.Any] = js.undefined): VNode = js.native
}
@js.native
class VNode(
selector: js.UndefOr[String],
data: js.UndefOr[VNodeData],
children: js.UndefOr[js.Array[VNode | String]],
text: js.UndefOr[String],
elm: js.UndefOr[Element | Text],
key: js.UndefOr[String | Double]
) extends js.Object
@js.native
class VNodeData extends js.Object
开发者ID:scalacenter,项目名称:scalajs-bundler,代码行数:34,代码来源:snabbdom.scala
示例14: props
//设置package包名称以及导入依赖的类
package snabbdom.modules
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.annotation.JSImport.Namespace
@JSImport("snabbdom/modules/class", Namespace)
@js.native
object `class` extends js.Object
@JSImport("snabbdom/modules/props", Namespace)
@js.native
object props extends js.Object
@JSImport("snabbdom/modules/style", Namespace)
@js.native
object style extends js.Object
@JSImport("snabbdom/modules/eventlisteners", Namespace)
@js.native
object eventlisteners extends js.Object
开发者ID:scalacenter,项目名称:scalajs-bundler,代码行数:22,代码来源:modules.scala
示例15: uuid
//设置package包名称以及导入依赖的类
package uuid
import scala.annotation.meta.field
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.annotation.{JSExport, JSImport}
import scala.scalajs.js.|
@JSImport("node-uuid/uuid", Namespace)
@js.native
object uuid extends UUID
@js.native
trait UUID extends js.Object {
def v1(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native
def v1(
options: UUIDOptions,
buffer: js.Array[Double],
offset: js.UndefOr[Double]
): js.Array[Double] = js.native
def v4(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native
def v4(
options: UUIDOptions,
buffer: js.Array[Double],
offset: js.UndefOr[Double]
): js.Array[Double] = js.native
def parse(
id: String,
buffer: js.UndefOr[js.Array[Double]] = js.undefined,
offset: js.UndefOr[Double] = js.undefined
): js.Array[Double] = js.native
def unparse(
buffer: js.Array[Double],
offset: js.UndefOr[Double] = js.undefined
): String = js.native
}
case class UUIDOptions(
@(JSExport @field) node: js.UndefOr[js.Array[js.Any]] = js.undefined,
@(JSExport @field) clockseq: js.UndefOr[Double] = js.undefined,
@(JSExport @field) msecs: js.UndefOr[Double | js.Date] = js.undefined,
@(JSExport @field) nsecs: js.UndefOr[Double] = js.undefined
)
开发者ID:scalacenter,项目名称:scalajs-bundler,代码行数:51,代码来源:uuid.scala
示例16: setView
//设置package包名称以及导入依赖的类
package leaflet
package modules
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.annotation.JSImport.Namespace
@js.native
trait Map extends js.Object {
def setView(center: js.Array[Float], zoom: Int): Map = js.native
def getZoom(): Int = js.native
def addLayer(layer: Layer): js.Dynamic = js.native
}
@js.native
trait Layer extends js.Object {
def addTo(map: Map): js.Dynamic = js.native
}
@JSImport("leaflet", JSImport.Namespace)
@js.native
object Leaflet extends js.Object {
def map(elem: String): Map = js.native
def tileLayer(url: String): Layer = js.native
}
@JSImport("!style-loader!css-loader!leaflet/dist/leaflet.css", JSImport.Default )
@js.native
object LeafletAssets extends js.Object {}
开发者ID:scalacenter,项目名称:scalajs-bundler,代码行数:34,代码来源:modules.scala
示例17: props
//设置package包名称以及导入依赖的类
package snabbdom
package modules
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.annotation.JSImport.Namespace
@JSImport("snabbdom/modules/class", Namespace)
@js.native
object `class` extends js.Object
@JSImport("snabbdom/modules/props", Namespace)
@js.native
object props extends js.Object
@JSImport("snabbdom/modules/style", Namespace)
@js.native
object style extends js.Object
@JSImport("snabbdom/modules/eventlisteners", Namespace)
@js.native
object eventlisteners extends js.Object
开发者ID:scalacenter,项目名称:scalajs-bundler,代码行数:23,代码来源:modules.scala
示例18: uuid
//设置package包名称以及导入依赖的类
package uuid
import scala.annotation.meta.field
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.annotation.{JSExport, JSImport}
import scala.scalajs.js.|
@JSImport("node-uuid/uuid", Namespace)
@js.native
object uuid extends js.Object {
def v1(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native
def v1(
options: UUIDOptions,
buffer: js.Array[Double],
offset: js.UndefOr[Double]
): js.Array[Double] = js.native
def v4(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native
def v4(
options: UUIDOptions,
buffer: js.Array[Double],
offset: js.UndefOr[Double]
): js.Array[Double] = js.native
def parse(
id: String,
buffer: js.UndefOr[js.Array[Double]] = js.undefined,
offset: js.UndefOr[Double] = js.undefined
): js.Array[Double] = js.native
def unparse(
buffer: js.Array[Double],
offset: js.UndefOr[Double] = js.undefined
): String = js.native
}
case class UUIDOptions(
@(JSExport @field) node: js.UndefOr[js.Array[js.Any]] = js.undefined,
@(JSExport @field) clockseq: js.UndefOr[Double] = js.undefined,
@(JSExport @field) msecs: js.UndefOr[Double | js.Date] = js.undefined,
@(JSExport @field) nsecs: js.UndefOr[Double] = js.undefined
)
开发者ID:scalacenter,项目名称:scalajs-bundler,代码行数:48,代码来源:uuid.scala
示例19: tpe
//设置package包名称以及导入依赖的类
package sri.relay.route
import sri.relay.container.RelayContainer.RootQueries
import sri.relay.route.RelayQueryConfig.Params
import scala.scalajs.js
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.{JSImport, JSName, ScalaJSDefined}
@js.native
trait ParamDefinition extends js.Object {
@JSName("type")
def tpe: String = js.native
def required: Boolean = js.native
}
object Params {
def apply(params: (String, js.Any)*): Params = params.toMap.toJSDictionary
}
object RelayQueryConfig {
type Params = js.Dictionary[js.Any]
}
@ScalaJSDefined
trait RelayQueryConfig extends js.Object {
val name: String
val params: js.Object
val queries: RootQueries
}
@js.native
@JSImport("react-relay", "Route")
abstract class AbstractRelayQueryConfig(initialParams: js.UndefOr[Params] = js.undefined) extends js.Object
开发者ID:chandu0101,项目名称:sri-relay,代码行数:36,代码来源:RelayRoute.scala
示例20: Socket
//设置package包名称以及导入依赖的类
package sharednodejsapis
import org.scalajs.dom.Event
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobal, JSImport, ScalaJSDefined}
import scala.scalajs.js.|
@ScalaJSDefined
trait ErrorEvent extends Event {
val stack: String
}
@ScalaJSDefined
trait RInfo extends js.Object {
val address: String
val port: Int
val family: String
}
@ScalaJSDefined
trait Address extends js.Object {
val address: String
val port: Int
}
@js.native
@JSGlobal("dgram.Socket")
abstract class Socket extends EventEmitter {
def address(): Address = js.native
def bind(port: Int, address: String = js.native): Unit = js.native
def close(): Unit = js.native
def send(msg: String | Buffer | js.Array[Buffer], port: Int, address: String): Unit = js.native
def send(msg: String | Buffer | js.Array[Buffer], port: Int, address: String, callback: js.Function): Unit = js.native
def send(msg: String | Buffer | js.Array[Buffer], offset: Int, length: Int, port: Int, address: String): Unit = js.native
def send(msg: String | Buffer | js.Array[Buffer], offset: Int, length: Int,
port: Int, address: String, callback: js.Function): Unit = js.native
}
@js.native
@JSImport("dgram", JSImport.Namespace)
object DgramModule extends js.Object {
def createSocket(t: String): Socket = js.native
}
开发者ID:sherpal,项目名称:oh-hell-card-game,代码行数:48,代码来源:Socket.scala
注:本文中的scala.scalajs.js.annotation.JSImport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论