mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Support for library source plugins
This commit is contained in:
committed by
Nick O'Leary
parent
f96ce2fd83
commit
8a076c01ab
11
test/resources/plugin/test-plugin/library-filestore.html
Normal file
11
test/resources/plugin/test-plugin/library-filestore.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<script type="text/javascript">
|
||||
RED.plugins.registerPlugin("node-red-library-filestore", {
|
||||
type: "node-red-library-source",
|
||||
name: "Local File-System Library",
|
||||
icon: "font-awesome/fa-hdd-o",
|
||||
defaults: {
|
||||
name: { value: "" },
|
||||
path: { value: ""}
|
||||
}
|
||||
})
|
||||
</script>
|
32
test/resources/plugin/test-plugin/library-filestore.js
Normal file
32
test/resources/plugin/test-plugin/library-filestore.js
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
module.exports = function(RED) {
|
||||
|
||||
class FileStorePlugin {
|
||||
constructor(config) {
|
||||
this.id = config.id;
|
||||
this.name = config.name;
|
||||
this.config = config;
|
||||
this.icon = config.icon;
|
||||
|
||||
console.log("FileStorePlugin",config)
|
||||
}
|
||||
async init() {
|
||||
console.log("FileStorePlugin.init")
|
||||
|
||||
}
|
||||
async getEntry(type,path) {
|
||||
console.log("FileStorePlugin.getLibraryEntry",type,path)
|
||||
return []
|
||||
}
|
||||
async saveEntry(type,path,meta,body) {
|
||||
console.log("FileStorePlugin.saveLibraryEntry",type,path)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RED.plugins.registerPlugin("node-red-library-filestore", {
|
||||
type: "node-red-library-source",
|
||||
class: FileStorePlugin
|
||||
})
|
||||
}
|
@@ -6,7 +6,8 @@
|
||||
"plugins": {
|
||||
"test": "test.js",
|
||||
"test-editor-plugin": "test-editor-plugin.html",
|
||||
"test-runtime-plugin": "test-runtime-plugin.js"
|
||||
"test-runtime-plugin": "test-runtime-plugin.js",
|
||||
"library-filestore": "library-filestore.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user