blob: 493e5a95e73c10bd4c3a160a9e664b572aae52be [file] [log] [blame]
///////////////////////////////////////////////////////////////
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
///////////////////////////////////////////////////////////////
[[javascript, Scripting with JavaScript]]
== Javascript ==
In Javascript, we map directly to JS functions with the same name.
For the following Polygene composite type,
[snippet,java]
----
source=libraries/scripting/src/test/java/org/apache/polygene/library/scripting/HelloSpeaker.java
tag=speaker
----
we need a implementation in a resource file (visible on classpath) named +org/apache/polygene/library/scripting/HelloSpeaker.js+
that looks like this;
[snippet,javascript]
----
source=libraries/scripting/src/test/resources/org/apache/polygene/library/scripting/HelloSpeaker.js
tag=script
----