added jslib changes
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
package js.annotations;
|
package js.annotations;
|
||||||
|
|
||||||
annotation class Native(name : String = "")
|
annotation class native(name : String = "")
|
||||||
|
annotation class library(name : String = "") {}
|
||||||
annotation class LibraryClass() {}
|
|
||||||
annotation class LibraryFun(name : String = "") {}
|
|
||||||
+12
-12
@@ -1,26 +1,26 @@
|
|||||||
package js;
|
package js;
|
||||||
|
|
||||||
import js.annotations.LibraryFun
|
import js.annotations.library
|
||||||
import js.annotations.LibraryClass
|
import js.annotations.library
|
||||||
import js.annotations.Native
|
import js.annotations.native
|
||||||
|
|
||||||
LibraryFun("println")
|
library("println")
|
||||||
fun println() {}
|
fun println() {}
|
||||||
LibraryFun("println")
|
library("println")
|
||||||
fun println(s : Any?) {}
|
fun println(s : Any?) {}
|
||||||
LibraryFun("print")
|
library("print")
|
||||||
fun print(s : Any?) {}
|
fun print(s : Any?) {}
|
||||||
LibraryFun("parseInt")
|
library("parseInt")
|
||||||
fun parseInt(s : String) : Int = 0
|
fun parseInt(s : String) : Int = 0
|
||||||
LibraryClass
|
library
|
||||||
open class Exception() {}
|
open class Exception() {}
|
||||||
LibraryClass
|
library
|
||||||
class NumberFormatException() : Exception() {}
|
class NumberFormatException() : Exception() {}
|
||||||
|
|
||||||
Native
|
native
|
||||||
fun setTimeout(callback : ()-> Unit) {}
|
fun setTimeout(callback : ()-> Unit) {}
|
||||||
|
|
||||||
Native
|
native
|
||||||
fun setInterval(callback : ()-> Unit, ms : Int) {}
|
fun setInterval(callback : ()-> Unit, ms : Int) {}
|
||||||
Native
|
native
|
||||||
fun setInterval(callback : ()-> Unit) {}
|
fun setInterval(callback : ()-> Unit) {}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package java.lang
|
package java.lang
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import js.annotations.LibraryClass
|
import js.annotations.library
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
trait Iterable<T> {
|
trait Iterable<T> {
|
||||||
fun iterator() : java.util.Iterator<T> {}
|
fun iterator() : java.util.Iterator<T> {}
|
||||||
}
|
}
|
||||||
+11
-11
@@ -2,22 +2,22 @@ package java.util
|
|||||||
|
|
||||||
import js.annotations.*;
|
import js.annotations.*;
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public trait Comparator<T> {
|
public trait Comparator<T> {
|
||||||
fun compare(obj1 : T, obj2 : T) : Int;
|
fun compare(obj1 : T, obj2 : T) : Int;
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryFun("comparator")
|
library("comparator")
|
||||||
public fun comparator<T>(f : (T, T) -> Int) : Comparator<T> {}
|
public fun comparator<T>(f : (T, T) -> Int) : Comparator<T> {}
|
||||||
|
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public open class Iterator<T>() {
|
public open class Iterator<T>() {
|
||||||
open fun next() : T {}
|
open fun next() : T {}
|
||||||
open fun hasNext() : Boolean {}
|
open fun hasNext() : Boolean {}
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public open class ArrayList<erased E>() : java.util.List<E> {
|
public open class ArrayList<erased E>() : java.util.List<E> {
|
||||||
override public fun size() : Int {}
|
override public fun size() : Int {}
|
||||||
override public fun isEmpty() : Boolean {}
|
override public fun isEmpty() : Boolean {}
|
||||||
@@ -38,7 +38,7 @@ public open class ArrayList<erased E>() : java.util.List<E> {
|
|||||||
// override public fun addAll(index : Int, c : java.util.Collection<out E>) : Boolean {}
|
// override public fun addAll(index : Int, c : java.util.Collection<out E>) : Boolean {}
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public trait Collection<erased E> : java.lang.Iterable<E> {
|
public trait Collection<erased E> : java.lang.Iterable<E> {
|
||||||
open fun size() : Int
|
open fun size() : Int
|
||||||
open fun isEmpty() : Boolean
|
open fun isEmpty() : Boolean
|
||||||
@@ -55,7 +55,7 @@ public trait Collection<erased E> : java.lang.Iterable<E> {
|
|||||||
open fun clear() : Unit
|
open fun clear() : Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public trait List<erased E> : java.util.Collection<E> {
|
public trait List<erased E> : java.util.Collection<E> {
|
||||||
override fun size() : Int
|
override fun size() : Int
|
||||||
override fun isEmpty() : Boolean
|
override fun isEmpty() : Boolean
|
||||||
@@ -80,7 +80,7 @@ public trait List<erased E> : java.util.Collection<E> {
|
|||||||
// open fun lastIndexOf(o : Any?) : Int
|
// open fun lastIndexOf(o : Any?) : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public trait Set<erased E> : java.util.Collection<E> {
|
public trait Set<erased E> : java.util.Collection<E> {
|
||||||
override fun size() : Int
|
override fun size() : Int
|
||||||
override fun isEmpty() : Boolean
|
override fun isEmpty() : Boolean
|
||||||
@@ -97,7 +97,7 @@ public trait Set<erased E> : java.util.Collection<E> {
|
|||||||
override fun clear() : Unit
|
override fun clear() : Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public open class HashSet<erased E>() : java.util.Set<E> {
|
public open class HashSet<erased E>() : java.util.Set<E> {
|
||||||
override public fun iterator() : java.util.Iterator<E> {}
|
override public fun iterator() : java.util.Iterator<E> {}
|
||||||
override public fun size() : Int {}
|
override public fun size() : Int {}
|
||||||
@@ -109,7 +109,7 @@ public open class HashSet<erased E>() : java.util.Set<E> {
|
|||||||
override fun addAll(c : java.util.Collection<out E>) : Boolean
|
override fun addAll(c : java.util.Collection<out E>) : Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public trait Map<erased K, erased V> {
|
public trait Map<erased K, erased V> {
|
||||||
open fun size() : Int
|
open fun size() : Int
|
||||||
open fun isEmpty() : Boolean
|
open fun isEmpty() : Boolean
|
||||||
@@ -124,7 +124,7 @@ public trait Map<erased K, erased V> {
|
|||||||
open fun values() : java.util.Collection<V>
|
open fun values() : java.util.Collection<V>
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public open class HashMap<erased K, erased V>() : java.util.Map<K, V> {
|
public open class HashMap<erased K, erased V>() : java.util.Map<K, V> {
|
||||||
override public fun size() : Int {}
|
override public fun size() : Int {}
|
||||||
override public fun isEmpty() : Boolean {}
|
override public fun isEmpty() : Boolean {}
|
||||||
@@ -139,7 +139,7 @@ public open class HashMap<erased K, erased V>() : java.util.Map<K, V> {
|
|||||||
override public fun values() : java.util.Collection<V> {}
|
override public fun values() : java.util.Collection<V> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryClass
|
library
|
||||||
public class StringBuilder() {
|
public class StringBuilder() {
|
||||||
public fun append(obj : Any) : StringBuilder
|
public fun append(obj : Any) : StringBuilder
|
||||||
public fun toString() : String
|
public fun toString() : String
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package java.util.Collections;
|
package java.util.Collections;
|
||||||
|
|
||||||
import js.annotations.LibraryFun
|
import js.annotations.library
|
||||||
import java.util.Collection
|
import java.util.Collection
|
||||||
import java.util.Comparator
|
import java.util.Comparator
|
||||||
|
|
||||||
LibraryFun("collectionsMax")
|
library("collectionsMax")
|
||||||
public fun max<T>(col : Collection<T>, comp : Comparator<T>) {}
|
public fun max<T>(col : Collection<T>, comp : Comparator<T>) {}
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
package js
|
package js
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import js.annotations.LibraryFun
|
import js.annotations.library
|
||||||
|
|
||||||
class Json() {
|
class Json() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryFun("jsonSet")
|
library("jsonSet")
|
||||||
fun Json.set(paramName : String, value : Any?) : Unit {}
|
fun Json.set(paramName : String, value : Any?) : Unit {}
|
||||||
LibraryFun("jsonGet")
|
library("jsonGet")
|
||||||
fun Json.get(paramName : String) : Any? = null
|
fun Json.get(paramName : String) : Any? = null
|
||||||
|
|
||||||
fun <K, V> Map<K, V>.toJson() : Json = Json()
|
fun <K, V> Map<K, V>.toJson() : Json = Json()
|
||||||
LibraryFun("jsonFromTuples")
|
library("jsonFromTuples")
|
||||||
fun json(vararg pairs : Tuple2<String, Any?>) = Json()
|
fun json(vararg pairs : Tuple2<String, Any?>) = Json()
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package html5
|
package html5
|
||||||
|
|
||||||
import js.annotations.Native
|
import js.annotations.native
|
||||||
|
|
||||||
Native
|
native
|
||||||
class Context() {
|
class Context() {
|
||||||
fun save() {}
|
fun save() {}
|
||||||
fun restore() {}
|
fun restore() {}
|
||||||
@@ -46,18 +46,18 @@ class Context() {
|
|||||||
fun measureText(text : String) : TextMetrics = TextMetrics();
|
fun measureText(text : String) : TextMetrics = TextMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
Native
|
native
|
||||||
class TextMetrics() {
|
class TextMetrics() {
|
||||||
val width : Int = 0
|
val width : Int = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Native
|
native
|
||||||
fun getContext() : Context = Context();
|
fun getContext() : Context = Context();
|
||||||
|
|
||||||
Native
|
native
|
||||||
fun random() : Double = 0.0
|
fun random() : Double = 0.0
|
||||||
|
|
||||||
Native
|
native
|
||||||
fun getCanvasWidth() : Double = 0.0
|
fun getCanvasWidth() : Double = 0.0
|
||||||
Native
|
native
|
||||||
fun getCanvasHeight() : Double = 0.0
|
fun getCanvasHeight() : Double = 0.0
|
||||||
@@ -2,7 +2,7 @@ package jquery;
|
|||||||
|
|
||||||
import js.annotations.*;
|
import js.annotations.*;
|
||||||
|
|
||||||
Native
|
native
|
||||||
class JQuery() {
|
class JQuery() {
|
||||||
fun addClass(className : String) : JQuery = this;
|
fun addClass(className : String) : JQuery = this;
|
||||||
fun addClass(f : DomElement.(Int, String)->String) = this;
|
fun addClass(f : DomElement.(Int, String)->String) = this;
|
||||||
@@ -35,15 +35,15 @@ open class DomElement() {
|
|||||||
|
|
||||||
//val document = object : DomElement() {}
|
//val document = object : DomElement() {}
|
||||||
|
|
||||||
Native("$")
|
native("$")
|
||||||
fun jq(selector : String) = JQuery();
|
fun jq(selector : String) = JQuery();
|
||||||
Native("$")
|
native("$")
|
||||||
fun jq(selector : String, context : DomElement) = JQuery();
|
fun jq(selector : String, context : DomElement) = JQuery();
|
||||||
Native("$")
|
native("$")
|
||||||
fun jq(callback : () -> Unit) = JQuery();
|
fun jq(callback : () -> Unit) = JQuery();
|
||||||
Native("$")
|
native("$")
|
||||||
fun jq(obj : JQuery) = JQuery();
|
fun jq(obj : JQuery) = JQuery();
|
||||||
Native("$")
|
native("$")
|
||||||
fun jq(el : DomElement) = JQuery();
|
fun jq(el : DomElement) = JQuery();
|
||||||
Native("$")
|
native("$")
|
||||||
fun jq() = JQuery();
|
fun jq() = JQuery();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package raphael
|
|||||||
import js.annotations.*;
|
import js.annotations.*;
|
||||||
import js.*;
|
import js.*;
|
||||||
|
|
||||||
Native
|
native
|
||||||
open class Element() {
|
open class Element() {
|
||||||
|
|
||||||
fun attr(name : String, value : Any?) : Element = this
|
fun attr(name : String, value : Any?) : Element = this
|
||||||
@@ -24,12 +24,12 @@ open class Element() {
|
|||||||
//fun mouse
|
//fun mouse
|
||||||
}
|
}
|
||||||
|
|
||||||
Native
|
native
|
||||||
class Set() : Element() {
|
class Set() : Element() {
|
||||||
fun push(el : Element) {}
|
fun push(el : Element) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Native
|
native
|
||||||
class Paper() {
|
class Paper() {
|
||||||
fun path(pathString : String) : Element = Element();
|
fun path(pathString : String) : Element = Element();
|
||||||
fun path() : Element = Element();
|
fun path() : Element = Element();
|
||||||
@@ -41,20 +41,20 @@ class Paper() {
|
|||||||
val customAttributes : Json = Json();
|
val customAttributes : Json = Json();
|
||||||
}
|
}
|
||||||
|
|
||||||
Native("Raphael")
|
native("Raphael")
|
||||||
fun Raphael(elementId : String, width : Int, height : Int) : Paper = Paper();
|
fun Raphael(elementId : String, width : Int, height : Int) : Paper = Paper();
|
||||||
Native("Raphael")
|
native("Raphael")
|
||||||
fun Raphael(elementId : String, width : Int, height : Int, initFun : Paper.() -> Unit) : Unit {}
|
fun Raphael(elementId : String, width : Int, height : Int, initFun : Paper.() -> Unit) : Unit {}
|
||||||
|
|
||||||
Native
|
native
|
||||||
fun getColor() : Color {}
|
fun getColor() : Color {}
|
||||||
Native
|
native
|
||||||
fun resetColors() {}
|
fun resetColors() {}
|
||||||
|
|
||||||
Native
|
native
|
||||||
class Color() {}
|
class Color() {}
|
||||||
|
|
||||||
Native
|
native
|
||||||
class Point() {
|
class Point() {
|
||||||
val x = 0
|
val x = 0
|
||||||
val y = 0
|
val y = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user