Skip to content

Commit d6d9d98

Browse files
authored
Merge pull request #526 from gzm0/no-06
Remove 0.6.x from living documentation
2 parents 9799280 + fd427bf commit d6d9d98

File tree

16 files changed

+9
-885
lines changed

16 files changed

+9
-885
lines changed

doc/internals/scalajs-0.6.x-eol.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ Please upgrade to Scala.js 1.x as soon as possible.
1818
See [the release notes of Scala.js 1.0.0]({{ BASE_PATH }}/news/2020/02/25/announcing-scalajs-1.0.0/) for important migration information.
1919

2020
There are no plans to offer paid support for Scala.js 0.6.x.
21+
22+
The last version of this website with 0.6.x documentation is at [9799280](https://github.com/scala-js/scala-js-website/tree/9799280483e3a21bb519e624b7fdb16e6a6af9c9).

doc/interoperability/export-to-javascript.md

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,6 @@ object HelloWorld {
5555

5656
exports the `HelloWorld` object in JavaScript.
5757

58-
**Pre 0.6.15 note**: Before Scala.js 0.6.15, objects were exported as 0-argument
59-
functions using `@JSExport`, rather than directly with `@JSExportTopLevel`. This
60-
is deprecated in 0.6.x, and not supported anymore in Scala.js 1.x.
61-
62-
### Exporting under a namespace (deprecated)
63-
64-
**Note:** Deprecated since Scala.js 0.6.26, and not supported anymore in Scala.js 1.x.
65-
66-
The export name can contain dots, in which case the exported object is namespaced in JavaScript.
67-
For example,
68-
69-
{% highlight scala %}
70-
@JSExportTopLevel("myapp.foo.MainObject")
71-
object HelloWorld {
72-
...
73-
}
74-
{% endhighlight %}
75-
76-
will be accessible in JavaScript using `myapp.foo.MainObject`.
77-
7858
## Exporting classes
7959

8060
The `@JSExportTopLevel` annotation can also be used to export Scala.js classes
@@ -99,10 +79,6 @@ will log the string `"Foo(3)"` to the console. This particular example works
9979
because it calls `toString()`, which is always exported to JavaScript. Other
10080
methods must be exported explicitly as shown in the next section.
10181

102-
**Pre 0.6.15 note**: Before Scala.js 0.6.15, classes were exported using
103-
`@JSExport` instead of `@JSExportTopLevel`, with the same meaning. This is
104-
deprecated in 0.6.x, and not supported anymore in Scala.js 1.x.
105-
10682
## Exports with modules
10783

10884
When [emitting a module for Scala.js code](../project/module.html), top-level exports are not sent to the JavaScript global scope.
@@ -202,49 +178,6 @@ gives:
202178
Hint to recognize this error: the methods are named `$js$exported$meth$`
203179
followed by the JavaScript export name.
204180

205-
### <a name="JSExportNamed"></a> Exporting for call with named parameters (deprecated)
206-
207-
**Note:** Since Scala.js 0.6.11, `@JSExportNamed` is deprecated, and is not supported anymore in Scala.js 1.x.
208-
Refer to [the Scaladoc]({{ site.production_url }}/api/scalajs-library/0.6.18/#scala.scalajs.js.annotation.JSExportNamed) for migration tips.
209-
210-
It is customary in Scala to call methods with named parameters if this eases understanding of the code or if many arguments with default values are present:
211-
212-
{% highlight scala %}
213-
def foo(x: Int = 1, y: Int = 2, z: Int = 3) = ???
214-
215-
foo(y = 3, x = 2)
216-
{% endhighlight %}
217-
218-
A rough equivalent in JavaScript is to pass an object with the respective properties:
219-
{% highlight javascript %}
220-
foo({
221-
y: 3,
222-
x: 2
223-
});
224-
{% endhighlight %}
225-
226-
The `@JSExportNamed` annotation allows to export Scala methods for use in JavaScript with named parameters:
227-
228-
{% highlight scala %}
229-
class A {
230-
@JSExportNamed
231-
def foo(x: Int, y: Int = 2, z: Int = 3) = ???
232-
}
233-
{% endhighlight %}
234-
235-
Note that default parameters are not required. `foo` can then be called like this:
236-
{% highlight javascript %}
237-
var a = // ...
238-
a.foo({
239-
y: 3,
240-
x: 2
241-
});
242-
{% endhighlight %}
243-
244-
Not specifying `x` in this case will fail at runtime (since it does not have a default value).
245-
246-
Just like `@JSExport`, `@JSExportNamed` takes the name of the exported method as an optional argument.
247-
248181
## Exporting top-level methods
249182

250183
While an `@JSExport`ed method inside an `@JSExportTopLevel` object allows JavaScript code to call a "static" method,
@@ -401,43 +334,3 @@ class B(val a: Int) extends A {
401334
def sum(x: Int, y: Int): Int = x + y
402335
}
403336
{% endhighlight %}
404-
405-
## Deprecated: Automatically exporting descendent objects or classes
406-
407-
**Pre 0.6.15 note**: Before Scala.js 0.6.15, this deprecated feature used to be
408-
often used to "reflectively" instantiate classes and load objects. This use case
409-
has been replaced by the
410-
[`scala.scalajs.reflect.Reflect`]({{ site.production_url }}/api/scalajs-library/latest/#scala.scalajs.reflect.Reflect$)
411-
API.
412-
This feature is not supported anymore in Scala.js 1.x.
413-
414-
When applied to a class or trait, `@JSExportDescendentObjects` causes all
415-
objects extending it to be automatically exported as 0-arg functions, under
416-
their fully qualified name. For example:
417-
418-
{% highlight scala %}
419-
package foo.test
420-
421-
@JSExportDescendentObjects
422-
trait Test {
423-
@JSExport
424-
def test(param: String): Unit
425-
}
426-
427-
// automatically exported as foo.test.Test1
428-
object Test1 extends Test {
429-
// exported through inheritance
430-
def test(param: String): Unit = {
431-
println(param)
432-
}
433-
}
434-
{% endhighlight %}
435-
436-
can be used from JavaScript as:
437-
438-
{% highlight javascript %}
439-
foo.test.Test1().test("hello"); // note the () in Test1()
440-
{% endhighlight %}
441-
442-
Similarly, `@JSExportDescendentClasses` causes all non-abstract classes
443-
the annotated class or trait to be exported under their fully qualified name.

doc/interoperability/facade-types.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ There are also non-native JS traits (aka Scala.js-defined JS traits), documented
2525
The latter have more restrictions, but can be *implemented* from Scala.js code.
2626
Native JS traits as described here should only be used for interfaces that are exclusively implemented by the JavaScript library--not for interfaces/contracts meant to be implemented by the user of said library.
2727

28-
**Scala.js 0.6.x:** In Scala.js 0.6.x, unless using the `-P:scalajs:sjsDefinedByDefault` compiler option, the annotation `@js.native` is assumed by default, with a deprecation warning.
29-
You might still find old code that does not yet use it to annotate native JS types.
30-
3128
In native JS types, all concrete definitions must have `= js.native` as body.
32-
Any other body will be handled as if it were `= js.native`, and a warning will be emitted.
33-
(In Scala.js 1.x, this is an error.)
3429

3530
Here is an example giving types to a small portion of the API of `Window`
3631
objects in browsers.
@@ -179,10 +174,6 @@ class RegExp(pattern: String) extends js.Object {
179174
}
180175
{% endhighlight %}
181176

182-
**Pre 0.6.15 note**: Before Scala.js 0.6.15, the `@JSGlobal` annotation did not
183-
exist, so you will find old code that does not yet use it to annotate native JS
184-
classes.
185-
186177
The call `new RegExp("[ab]*")` will map to the obvious in JavaScript, i.e.,
187178
`new RegExp("[ab]*")`, meaning that the identifier `RegExp` will be looked up
188179
in the global scope.
@@ -288,10 +279,7 @@ object DOMGlobalScope extends js.Object {
288279
}
289280
{% endhighlight %}
290281

291-
Prior to 0.6.13, `extends js.GlobalScope` was used instead of `@JSGlobalScope`.
292-
`js.GlobalScope` is now deprecated.
293-
294-
**Scala.js 1.x:** Also read [access to the JavaScript global scope](./global-scope.html).
282+
Also read [access to the JavaScript global scope](./global-scope.html).
295283

296284
## <a name="import"></a> Imports from other JavaScript modules
297285

@@ -577,9 +565,7 @@ reflective call can therefore not be generated.
577565

578566
Sometimes, it is more convenient to manipulate JavaScript values in a dynamically typed way.
579567
Although it is not recommended to do so for APIs that are used repetitively, Scala.js lets you call JavaScript in a dynamically typed fashion if you want to.
580-
The basic entry point is to grab a dynamically typed reference to the global scope, with `js.Dynamic.global`, which is of type `js.Dynamic`.
581-
582-
**Scala.js 1.x:** In Scala.js 1.x, `js.Dynamic.global` is a [global scope object](./global-scope.html) instead of an actual value of type `js.Dynamic`.
568+
The basic entry point is to grab a dynamically typed reference to the [global scope](./global-scope.html), with `js.Dynamic.global`, which is of type `js.Dynamic`.
583569

584570
You can read and write any field of a `js.Dynamic`, as well as call any method
585571
with any number of arguments. All input types are assumed to be of type

doc/interoperability/global-scope.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ layout: doc
33
title: Access to the JavaScript global scope in Scala.js
44
---
55

6-
**This page applies to Scala.js 1.x only.**
7-
86
Unlike Scala, JavaScript has a *global scope*, where global variables are defined.
97
For example, one can define a variable `foo` at the top-level of a script:
108

@@ -212,7 +210,7 @@ if (!js.isUndefined(js.Dynamic.global.Promise)) {
212210
}
213211
{% endhighlight %}
214212

215-
In Scala.js 1.x, accessing `js.Dynamic.global.Promise` will throw a `ReferenceError` if `Promise` is not defined, so this does not work anymore.
213+
In modern Scala.js, accessing `js.Dynamic.global.Promise` will throw a `ReferenceError` if `Promise` is not defined, so this does not work anymore.
216214
Instead, you must use `js.typeOf`:
217215

218216
{% highlight scala %}

doc/interoperability/sjs-defined-js-classes.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@ title: Non-native JS types (aka Scala.js-defined JS types)
66
A non-native JS type, aka Scala.js-defined JS type, is a JavaScript type implemented in Scala.js code.
77
This is in contrast to native JS types, described in [the facade types reference](./facade-types.html), which represent APIs implemented in JavaScript code.
88

9-
## About `@ScalaJSDefined`
10-
11-
In Scala.js 0.6.x, the `@ScalaJSDefined` is necessary to declare a non-native JS type, also called a Scala.js-defined JS type.
12-
Starting from Scala.js 1.x however, the annotation is not necessary anymore.
13-
Since Scala.js 0.6.17, you can opt-in for the new semantics of 1.x where `@ScalaJSDefined` is not necessary, by giving the option `-P:scalajs:sjsDefinedByDefault` to scalac.
14-
In an sbt build, this is done with
15-
16-
{% highlight scala %}
17-
scalacOptions += "-P:scalajs:sjsDefinedByDefault"
18-
{% endhighlight %}
19-
20-
The present documentation assumes that you are using this option (or Scala.js 1.x).
21-
Code snippets mention the necessary `@ScalaJSDefined` in comments as a reference for older versions.
22-
239
## Defining a non-native JS type
2410

2511
Any class, trait or object that inherits from `js.Any` is a JS type.
@@ -36,7 +22,7 @@ class Foo extends js.Object {
3622
}
3723
{% endhighlight %}
3824

39-
Such classes are called *non-native JS classes*, and are also known as Scala.js-defined JS classes (especially in 0.6.x).
25+
Such classes are called *non-native JS classes*, and were previously known as Scala.js-defined JS classes.
4026
All their members are automatically visible from JavaScript code.
4127
The class itself (its constructor function) is not visible by default, but can be exported with `@JSExportTopLevel`.
4228
Moreover, they can extend JavaScript classes (native or not), and, if exported, be extended by JavaScript classes.
@@ -324,8 +310,6 @@ val pos = new Position {
324310
}
325311
{% endhighlight %}
326312

327-
Note that anonymous classes extending `js.Any` are always non-native, even in 0.6.x without `-P:scalajs:sjsDefinedByDefault` nor `@ScalaJSDefined`.
328-
329313
#### Use case: configuration objects
330314

331315
For configuration objects that have fields with default values, concrete members with `= js.undefined` can be used in the trait.

doc/project/building.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ Just like in a JVM project, sbt will automatically detect the object with a `mai
3737
Note that this will require that there is a *unique* such object or that the one to use be explicitly set with `mainClass in Compile := Some(<name>)`.
3838
If you explicitly set `mainClass`, note that it needs to be set on a per-configuration basis (i.e. the part `in Compile` is essential, otherwise the setting will be ignored). For further information see the Stack Overflow entry ['How to set mainClass in ScalaJS build.sbt?'](http://stackoverflow.com/questions/34965072/how-to-set-mainclass-in-scalajs-build-sbt) (specific to Scala.js) and the Stack Overflow entry ['How to set main class in build?'](http://stackoverflow.com/questions/6467423/how-to-set-main-class-in-build) (not specific to Scala.js).
3939

40-
**Note for Scala.js 0.6.17 and earlier:** in Scala.js 0.6.17 and earlier, the main object was required to extend the special trait [`js.JSApp`]({{ site.production_url }}/api/scalajs-library/0.6.20/#scala.scalajs.js.JSApp).
41-
Since 0.6.18, any object with a standard `main` method will be recognized.
42-
`js.JSApp` is now deprecated.
43-
See [the Scaladoc of `js.JSApp`]({{ site.production_url }}/api/scalajs-library/0.6.20/#scala.scalajs.js.JSApp) for migration tips.
44-
4540
## Produce JavaScript code
4641

4742
To produce JavaScript code from your Scala code, you need to call the linker:
@@ -66,19 +61,9 @@ You can run a Scala.js application (that has `scalaJSUseMainModuleInitializer` s
6661
This will run the `main.js` file right inside of your sbt console.
6762
By default, the file is run with [Node.js](https://nodejs.org/), which you need to install separately.
6863

69-
**Scala.js 0.6.x only:** If your application or one of its libraries requires a DOM (which can be specified with `jsDependencies += RuntimeDOM`), you will also need to install [`jsdom`](https://github.com/jsdom/jsdom) with `npm install jsdom`.
70-
`jsDependencies += RuntimeDOM` is now deprecated, and should be replaced by `jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv()`.
71-
7264
There are alternative JavaScript interpreters that are available.
7365
See [JavaScript environments](./js-environments.html) for more details.
7466

75-
### Deprecated: Run without `scalaJSUseMainModuleInitializer`
76-
77-
**Scala.js 0.6.x only**
78-
79-
It is still possible to `run` a Scala.js application that does not have `scalaJSUseMainModuleInitializer := true`.
80-
However, this is not recommended anymore.
81-
8267
## Disabling the optimizations
8368

8469
If, for some reason (for example, to make stepping through the code with a debugger more predictable), you want to disable the optimizations, you can do so with the following sbt setting:
@@ -106,18 +91,3 @@ You can run your code and tests in fullOpt stage with the following command:
10691

10792
**Note for Scala.js 1.2.x and earlier:** in Scala.js 1.2.x and earlier, we used `fullOptJS` instead of `fullLinkJS`, which always produces a single file with the suffix `-opt.js`.
10893
`scalaJSStage` works the same way in Scala.js 1.2.x and in later versions.
109-
110-
## Deprecated: Writing Launcher Code
111-
112-
**Scala.js 0.6.x only**
113-
114-
For applications that do not use `scalaJSUseMainModuleInitializer := true`, it is possible to generate a small .js file that calls the `main` method, known as a "launcher" file.
115-
This is done with the following sbt setting:
116-
117-
{% highlight scala %}
118-
persistLauncher := true
119-
{% endhighlight %}
120-
121-
The resulting file in the target folder will have the suffix `-launcher.js`.
122-
123-
This feature is deprecated: applications should migrate to using `scalaJSUseMainModuleInitializer`.

doc/project/cross-build.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
3838
You can then use the `crossProject` builder in your `build.sbt` file:
3939

4040
{% highlight scala %}
41-
// If using Scala.js 0.6.x, also add the following import:
42-
//import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
43-
4441
ThisBuild / scalaVersion := "2.13.1"
4542

4643
lazy val root = project.in(file(".")).

doc/project/dependencies.md

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,94 +20,3 @@ Note the `%%%` (instead of the usual `%%`) which will add the current Scala.js v
2020
Some Scala.js core libraries (such as the Scala.js library itself) do not need the `%%%` since their version number *is* the Scala.js version number itself.
2121

2222
Note that you can also use `%%%` in a Scala/JVM project, in which case it will be the same as `%%`. This allows you to use the same `libraryDependencies` settings when cross compiling Scala/JVM and Scala.js.
23-
24-
## Deprecated: Depending on JavaScript libraries
25-
26-
The `jsDependencies` mechanism should be considered deprecated.
27-
Use [scalajs-bundler](https://scalacenter.github.io/scalajs-bundler/) instead.
28-
29-
**Scala.js 1.x note:** since Scala.js 1.x, this functionality is not part of the core Scala.js sbt plugin.
30-
Instead, it is provided by [sbt-jsdependencies](https://github.com/scala-js/jsdependencies).
31-
32-
The rest of this section applies to Scala.js 0.6.x only.
33-
[Scala.js 0.6.x has reached End of Life.]({{ BASE_PATH }}/doc/internals/scalajs-0.6.x-eol.html)
34-
35-
Thanks to [WebJars](http://www.webjars.org/), you can easily fetch a JavaScript library like so:
36-
37-
{% highlight scala %}
38-
libraryDependencies += "org.webjars" % "jquery" % "2.1.4"
39-
{% endhighlight %}
40-
41-
This will fetch the required JAR containing jQuery. However, it will not include it once you run your JavaScript code, since there is no class-loading process for JavaScript.
42-
43-
The Scala.js sbt plugin has `jsDependencies` for this purpose. You can write:
44-
45-
{% highlight scala %}
46-
jsDependencies += "org.webjars" % "jquery" % "2.1.4" / "2.1.4/jquery.js"
47-
{% endhighlight %}
48-
49-
This will make your project depend on the respective WebJar and include a file named `**/2.1.4/jquery.js` in the said WebJar when your project is run or tested. We are trying to make the semantics of "include" to be as close as possible to writing:
50-
51-
{% highlight html %}
52-
<script type="text/javascript" src="..."></script>
53-
{% endhighlight %}
54-
55-
All `jsDependencies` and associated metadata (e.g. for ordering) are persisted in a file (called `JS_DEPENDENCIES`) and shipped with the artifact your project publishes. For example, if you depend on the `scalajs-jquery` package for Scala.js, you do not need to explicitly depend or include `jquery.js`; this mechanism does it for you.
56-
57-
Note: This will **not** dump the JavaScript libraries in the file containing your compiled Scala.js code as this would not work across all JavaScript virtual machines. However, the Scala.js plugin can generate a separate file that contains all raw JavaScript dependencies (see [below](#packageJSDependencies)).
58-
59-
### Scoping to a Configuration
60-
61-
You may scope `jsDependencies` on a given configuration, just like for normal `libraryDependencies`:
62-
63-
{% highlight scala %}
64-
jsDependencies += "org.webjars" % "jquery" % "2.1.4" / "jquery.js" % "test"
65-
{% endhighlight %}
66-
67-
### CommonJS name
68-
69-
Some (most?) JavaScript libraries try to adapt the best they can to the environment in which they are being executed.
70-
When they do so, you have to specify explicitly the name under which they are exported in a CommonJS environment (such as Node.js), otherwise they won't work when executed in Node.js.
71-
This is the purpose of the `commonJSName` directive, to be used like this:
72-
73-
{% highlight scala %}
74-
jsDependencies += "org.webjars" % "mustachejs" % "0.8.2" / "mustache.js" commonJSName "Mustache"
75-
{% endhighlight %}
76-
77-
which essentially translates to a prelude
78-
79-
{% highlight javascript %}
80-
var Mustache = require("mustache.js");
81-
{% endhighlight %}
82-
83-
when running with Node.js from sbt (with `run`, `test`, etc.).
84-
85-
### Dependency Ordering
86-
87-
Since JavaScript does not have a class loading mechanism, the order in which libraries are loaded may matter. If this is the case, you can specify a library's dependencies like so:
88-
89-
{% highlight scala %}
90-
jsDependencies += "org.webjars" % "jasmine" % "1.3.1" / "jasmine-html.js" dependsOn "jasmine.js"
91-
{% endhighlight %}
92-
93-
Note that the dependee must be declared as explicit dependency elsewhere, but not necessarily in this project (for example in a project the current project depends on).
94-
95-
### Local JavaScript Files
96-
97-
If you need to include JavaScript files which are provided in the resources of your project, use:
98-
99-
{% highlight scala %}
100-
jsDependencies += ProvidedJS / "myJSLibrary.js"
101-
{% endhighlight %}
102-
103-
This will look for `myJSLibrary.js` in the resources and include it. It is an error if it doesn't exist. You may use ordering and scoping if you need.
104-
105-
### <a name="packageJSDependencies"></a> Write a Dependency File
106-
107-
If you want all JavaScript dependencies to be concatenated to a single file (for easy inclusion into a HTML file for example), you can set:
108-
109-
{% highlight scala %}
110-
skip in packageJSDependencies := false
111-
{% endhighlight %}
112-
113-
in your project settings. The resulting file in the target folder will have the suffix `-jsdeps.js`.

0 commit comments

Comments
 (0)