Skip to content

Instantly share code, notes, and snippets.

@heathermiller
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heathermiller/e9a5a9fe2743260d4524 to your computer and use it in GitHub Desktop.
Save heathermiller/e9a5a9fe2743260d4524 to your computer and use it in GitHub Desktop.
/** @constructor */
ScalaJS.c.example_Person = (function() {
ScalaJS.c.java_lang_Object.call(this);
this.name$1 = null;
this.age$1 = 0
});
ScalaJS.c.example_Person.prototype = new ScalaJS.inheritable.java_lang_Object();
ScalaJS.c.example_Person.prototype.constructor = ScalaJS.c.example_Person;
ScalaJS.c.example_Person.prototype.name__T = (function() {
return this.name$1
});
ScalaJS.c.example_Person.prototype.age__I = (function() {
return this.age$1
});
ScalaJS.c.example_Person.prototype.copy__T__I__Lexample_Person = (function(name, age) {
return new ScalaJS.c.example_Person().init___T__I(name, age)
});
ScalaJS.c.example_Person.prototype.copy$default$1__T = (function() {
return this.name__T()
});
ScalaJS.c.example_Person.prototype.copy$default$2__I = (function() {
return this.age__I()
});
ScalaJS.c.example_Person.prototype.productPrefix__T = (function() {
return "Person"
});
ScalaJS.c.example_Person.prototype.productArity__I = (function() {
return 2
});
ScalaJS.c.example_Person.prototype.productElement__I__O = (function(x$1) {
var x1 = x$1;
switch (x1) {
case 0:
{
return this.name__T();
break
};
case 1:
{
return ScalaJS.bI(this.age__I());
break
};
default:
throw new ScalaJS.c.java_lang_IndexOutOfBoundsException().init___T(ScalaJS.objectToString(ScalaJS.bI(x$1)));
}
});
ScalaJS.c.example_Person.prototype.productIterator__Lscala_collection_Iterator = (function() {
return ScalaJS.modules.scala_runtime_ScalaRunTime().typedProductIterator__Lscala_Product__Lscala_collection_Iterator(this)
});
ScalaJS.c.example_Person.prototype.canEqual__O__Z = (function(x$1) {
return ScalaJS.is.example_Person(x$1)
});
ScalaJS.c.example_Person.prototype.hashCode__I = (function() {
var acc = -889275714;
acc = ScalaJS.modules.scala_runtime_Statics().mix__I__I__I(acc, ScalaJS.modules.scala_runtime_Statics().anyHash__O__I(this.name__T()));
acc = ScalaJS.modules.scala_runtime_Statics().mix__I__I__I(acc, this.age__I());
return ScalaJS.modules.scala_runtime_Statics().finalizeHash__I__I__I(acc, 2)
});
ScalaJS.c.example_Person.prototype.toString__T = (function() {
return ScalaJS.modules.scala_runtime_ScalaRunTime().$$undtoString__Lscala_Product__T(this)
});
ScalaJS.c.example_Person.prototype.equals__O__Z = (function(x$1) {
if ((this === x$1)) {
return true
} else {
var x1 = x$1;
matchEnd4: {
if (ScalaJS.is.example_Person(x1)) {
var jsx$1 = true;
break matchEnd4
};
var jsx$1 = false;
break matchEnd4
};
if (jsx$1) {
var Person$1 = ScalaJS.as.example_Person(x$1);
return ((ScalaJS.anyRefEqEq(this.name__T(), Person$1.name__T()) && (this.age__I() === Person$1.age__I())) && Person$1.canEqual__O__Z(this))
} else {
return false
}
}
});
ScalaJS.c.example_Person.prototype.init___T__I = (function(name, age) {
this.name$1 = name;
this.age$1 = age;
ScalaJS.c.java_lang_Object.prototype.init___.call(this);
ScalaJS.impls.scala_Product$class__$init$__Lscala_Product__V(this);
return this
});
ScalaJS.c.example_Person.prototype.canEqual__O__ = (function(x$1) {
return ScalaJS.bZ(this.canEqual__O__Z(x$1))
});
ScalaJS.c.example_Person.prototype.productIterator__ = (function() {
return this.productIterator__Lscala_collection_Iterator()
});
ScalaJS.c.example_Person.prototype.productElement__I__ = (function(x$1$2) {
return this.productElement__I__O(x$1$2)
});
ScalaJS.c.example_Person.prototype.productArity__ = (function() {
return ScalaJS.bI(this.productArity__I())
});
ScalaJS.c.example_Person.prototype.productPrefix__ = (function() {
return this.productPrefix__T()
});
ScalaJS.c.example_Person.prototype.copy$default$2__ = (function() {
return ScalaJS.bI(this.copy$default$2__I())
});
ScalaJS.c.example_Person.prototype.copy$default$1__ = (function() {
return this.copy$default$1__T()
});
ScalaJS.c.example_Person.prototype.copy__T__I__ = (function(name, age) {
return this.copy__T__I__Lexample_Person(name, age)
});
ScalaJS.c.example_Person.prototype.age__ = (function() {
return ScalaJS.bI(this.age__I())
});
ScalaJS.c.example_Person.prototype.name__ = (function() {
return this.name__T()
});
/** @constructor */
ScalaJS.inheritable.example_Person = (function() {
/*<skip>*/
});
ScalaJS.inheritable.example_Person.prototype = ScalaJS.c.example_Person.prototype;
ScalaJS.is.example_Person = (function(obj) {
return (!(!((obj && obj.$classData) && obj.$classData.ancestors.example_Person)))
});
ScalaJS.as.example_Person = (function(obj) {
if ((ScalaJS.is.example_Person(obj) || (obj === null))) {
return obj
} else {
ScalaJS.throwClassCastException(obj, "example.Person")
}
});
ScalaJS.isArrayOf.example_Person = (function(obj, depth) {
return (!(!(((obj && obj.$classData) && (obj.$classData.arrayDepth === depth)) && obj.$classData.arrayBase.ancestors.example_Person)))
});
ScalaJS.asArrayOf.example_Person = (function(obj, depth) {
if ((ScalaJS.isArrayOf.example_Person(obj, depth) || (obj === null))) {
return obj
} else {
ScalaJS.throwArrayCastException(obj, "Lexample.Person;", depth)
}
});
ScalaJS.data.example_Person = new ScalaJS.ClassTypeData({
example_Person: 0
}, false, "example.Person", ScalaJS.data.java_lang_Object, {
example_Person: 1,
scala_Serializable: 1,
java_io_Serializable: 1,
scala_Product: 1,
scala_Equals: 1,
java_lang_Object: 1
});
ScalaJS.c.example_Person.prototype.$classData = ScalaJS.data.example_Person;
ScalaJS.c.example_ScalaJSExample$.prototype.main__V = (function() {
var paragraph = ScalaJS.g["document"]["createElement"]("p");
var p = new ScalaJS.c.example_Person().init___T__I("Cleatus", 76);
paragraph["innerHTML"] = (((("<strong>Here's a Southerner, name: " + p.name__T()) + ", age: ") + ScalaJS.bI(p.age__I())) + "</strong>");
ScalaJS.g["document"]["getElementById"]("playground")["appendChild"](paragraph)
});
case class Person(name: String, age: Int)
@JSExport
object ScalaJSExample {
@JSExport
def main(): Unit = {
val paragraph = g.document.createElement("p")
val p = Person("Cleatus", 76)
paragraph.innerHTML = "<strong>Here's a Southerner, name: " + p.name + ", age: " + p.age + "</strong>"
g.document.getElementById("playground").appendChild(paragraph)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment