Skip to content

Instantly share code, notes, and snippets.

@stephendeyoung
Created December 22, 2015 16:55
Show Gist options
  • Save stephendeyoung/a6112fdfddf7740566d5 to your computer and use it in GitHub Desktop.
Save stephendeyoung/a6112fdfddf7740566d5 to your computer and use it in GitHub Desktop.
const EVT = require('evrythng-extended');
const evtClient = new EVT.TrustedApp(apiKey);
function onThngPropertiesChanged(event) {
evtClient.thng(event.thng.id).action('_custom').create({
customFields: {
test: true
}
}).then(() => done()).catch(done);
}
function onActionCreated(action) {
if (action.action.thng) {
evtClient.thng(action.action.thng).property().update([
{
"key": "testrules2",
"value": true
}
]).then(() => done()).catch(done);
} else if (action.action.collection) {
evtClient.collection(action.action.collection).update({
customFields: {
testrules: true
}
}).then(() => done()).catch(done);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment