mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Initial plugin runtime api implementation
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugin": "winning"
|
||||
}
|
12
test/resources/plugin/test-plugin/package.json
Normal file
12
test/resources/plugin/test-plugin/package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "test-plugin",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"node-red": {
|
||||
"plugins": {
|
||||
"test": "test.js",
|
||||
"test-editor-plugin": "test-editor-plugin.html",
|
||||
"test-runtime-plugin": "test-runtime-plugin.js"
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
<script type="text/javascript">
|
||||
console.log("Loaded test-plugin/test-editor-plugin")
|
||||
// RED.plugins.registerPlugin("")
|
||||
//
|
||||
</script>
|
10
test/resources/plugin/test-plugin/test-runtime-plugin.js
Normal file
10
test/resources/plugin/test-plugin/test-runtime-plugin.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = function(RED) {
|
||||
console.log("Loaded test-plugin/test-runtime-plugin")
|
||||
|
||||
RED.plugins.registerPlugin("my-test-runtime-only-plugin", {
|
||||
type: "bar",
|
||||
onadd: function() {
|
||||
console.log("my-test-runtime-only-plugin.onadd called")
|
||||
}
|
||||
})
|
||||
}
|
4
test/resources/plugin/test-plugin/test.html
Normal file
4
test/resources/plugin/test-plugin/test.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<script type="text/javascript">
|
||||
console.log("Loaded test-plugin/test")
|
||||
// RED.plugins.registerPlugin("")
|
||||
</script>
|
13
test/resources/plugin/test-plugin/test.js
Normal file
13
test/resources/plugin/test-plugin/test.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = function(RED) {
|
||||
console.log("Loaded test-plugin/test")
|
||||
|
||||
RED.plugins.registerPlugin("my-test-plugin", {
|
||||
type: "foo",
|
||||
onadd: function() {
|
||||
console.log("my-test-plugin.onadd called")
|
||||
RED.events.on("registry:plugin-added", function(id) {
|
||||
console.log(`my-test-plugin: plugin-added event "${id}"`)
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user