Comments (2)
@jungkumseok Do you know how we could add this to the metadata (do you have a sample JS file that shows how to declare metadata?)?
from thingsjs.
Yes, this feature was added in this commit: 7060821
One would provide metadata by writing a special block-comment at the top of the code. The block-comment must begin with /*things.meta
and close on a new line with */
. Inside the body of the block-comment, the user must provide metadata in valid YAML (significant white-space). Right now there is no schema for the metadata, so the user has total freedom over what information to include as metadata.
The YAML data will simply be converted into a JSON object and will be available upon running the component.
See example below:
/*things.meta
outputs:
things-js/motion-stream: video/mpeg
things-js/alarm: text/plain
constraints:
dynamic:
- cpuUsage
- memoryUsage
*/
var count = 0;
setInterval(function(){
count ++;
}, 1000);
Here the metadata will be converted into the following JSON:
{
"outputs": {
"things-js/motion-stream": "video/mpeg",
"things-js/alarm": "text/plain"
},
"constraints": {
"dynamic": [ "cpuUsage", "memoryUsage" ]
}
}
In the front-end (Dashboard), this object will be available as a property of the Program
object - i.e. program.meta.extra
.
from thingsjs.
Related Issues (20)
- Migration causes failure if the specific code already exists on the engine code is migrating to HOT 2
- Dispatcher can issue a migration request that comes back as failed even though it succeeded HOT 1
- Running code without a Code Engine causes Scheduler to crash HOT 1
- Scheduler doesn't have API for kill() and pause() HOT 1
- Scheduler: Exception thrown when CodeEngine device stats are not available HOT 2
- Scheduler: First-fit algorithm throws exception for empty device list HOT 1
- Scheduler: Incorrect view of the network for nodes that don't exit elegantly
- GFS: appendFile() and deleteFile() have small bug related to query HOT 3
- File system: Need to organise the directory structure. HOT 6
- Shell needs to be updated to use the latest API HOT 2
- GFS: Race condition for multiple nodes writing to same file
- Global File system: path direct error in readfile and writefile function HOT 3
- test:scheduler: asynchronous mocha tests should use mocha's async API HOT 3
- GFS: API functions invoked before mongodb connection fully resolves fails
- Guide: issues and typos HOT 2
- npm install not working
- Documentation update: install instructions
- Code Engine: Required module for blinking LED via GPIO will not compile on Windows
- Code Engine: Support for process.argv
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thingsjs.