diff --git a/root/src/config.json b/root/src/config.json
index 0dec2e1..aa4000f 100644
--- a/root/src/config.json
+++ b/root/src/config.json
@@ -18,7 +18,6 @@
"js_files": [
"js/main.js"
],
- "entrypoint": "{%= entrypoint %}",
"license": "{%= licenses %}",
"longdescription": "DESCRIPTION.md",
"name": "{%= name %}",
diff --git a/root/src/config.xml b/root/src/config.xml
index 0a702d5..c7fd500 100644
--- a/root/src/config.xml
+++ b/root/src/config.xml
@@ -34,6 +34,4 @@
-
-
diff --git a/root/src/js/main.js b/root/src/js/main.js
index baeead7..c0b44a3 100644
--- a/root/src/js/main.js
+++ b/root/src/js/main.js
@@ -6,13 +6,13 @@
* Licensed under the {%= licenses.join(', ') %} license{%= licenses.length === 1 ? '' : 's' %}.
*/
-/* exported {%= entrypoint %} */
+/* global Wirecloud */
-(function () {
+(function (script) {
"use strict";
- class {%= entrypoint %} {
+ class Operator {
constructor(MashupPlatform, extra) {
this.MashupPlatform = MashupPlatform;
@@ -22,11 +22,15 @@
}
}
- // We define the class as part of the window object so that it can be instantiated by Wirecloud
- window.{%= entrypoint %} = {%= entrypoint %};
+ if (!('Wirecloud' in window)) {
+ // For testing purposes
+ window.Operator = Operator;
+ } else {
+ Wirecloud.registerOperatorClass(script, Operator);
+ }
/* test-code */
/* end-test-code */
-})();
+})(document.currentScript);
diff --git a/root/src/ts/main.ts b/root/src/ts/main.ts
index efa80ee..05fdcd7 100644
--- a/root/src/ts/main.ts
+++ b/root/src/ts/main.ts
@@ -16,7 +16,7 @@ import MashupPlatform = require("MashupPlatform");
{% if (ngsi) { %}import NGSI = require("NGSI");{% }%}
/* end-import-block */
-export class {%= entrypoint %} {
+export class Operator {
private MashupPlatform: MashupPlatform;
{% if (ngsi) { %}private NGSI: NGSI;{% }%}
@@ -32,5 +32,4 @@ export class {%= entrypoint %} {
}
}
-// We define the class as part of the window object so that it can be instantiated by Wirecloud
-(window)["{%= entrypoint %}"] = {%= entrypoint %};
\ No newline at end of file
+(window).Wirecloud.registerOperatorClass((document).currentScript, Operator);
\ No newline at end of file
diff --git a/template.js b/template.js
index 0330ae7..82564fe 100644
--- a/template.js
+++ b/template.js
@@ -44,13 +44,6 @@ var capitalizeAndRemoveUnderscore = function capitalizeAndRemoveUnderscore(old)
return t.charAt(0).toUpperCase() + t.slice(1);
};
-var getEntrypointName = function getEntrypointName(vendor, name) {
- // Remove all non-alphanumeric characters. Replace spaces with underscores.
- vendor = vendor.replace(/[^a-zA-Z0-9]/g, '').replace(/\s/g, '_');
- name = name.replace(/[^a-zA-Z0-9]/g, '').replace(/\s/g, '_');
- return vendor + '_' + name;
-}
-
// The actual init template.
exports.template = function(grunt, init, done) {
init.process([
@@ -131,7 +124,6 @@ exports.template = function(grunt, init, done) {
], function(err, props){
var exportsOverride = {};
props.jsname = capitalizeAndRemoveUnderscore(props.name);
- props.entrypoint = getEntrypointName(props.vendor, props.name);
props.bower = props.jquery; // Change way to determine bower?
props.ngsi = false; // ??
var bowerdeps = {};