This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (got) { | |
const json = got.in.data.map(d => JSON.parse(d.value)); | |
const query = got.query; | |
const threadId = query[0]; | |
let newestCount = json | |
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) | |
.shift().count; | |
return [{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constructor() { | |
// You have to call the super() method to initialize the base class. | |
super(); | |
this._suHandler = this.onStorageUpdate.bind(this); | |
} | |
loadView(state) { | |
console.log('counter: loadView', state); | |
this.storage.subscribe(['count'], this._suHandler); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
constructor() { | |
// You have to call the super() method to initialize the base class. | |
super(); | |
this.controller.subscribe('counts', this.onCounts.bind(this)); | |
} | |
// for more info: https://docs.redsift.com/docs/client-code-siftview | |
presentView(value) { | |
console.log('counter: presentView: ', value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="column"> | |
<p>I'm a Sift!</p> | |
<p id='number'>0</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadThreadListView (listInfo) { | |
console.log('counter: loadThreadListView: ', listInfo); | |
if (listInfo) { | |
return { | |
template: '001_list_common_txt', | |
value: { | |
color: '#ffffff', | |
backgroundColor: '#e11010', | |
subtitle: listInfo + ' words' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dag": { | |
"inputs": { | |
"rpc": { | |
"simple_rpc": { | |
"methods": ["GET"], | |
"path": "/simple", | |
"CORS": {} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const newResponse = (status_code, header, body) => { | |
return { status_code, header, | |
body: Buffer.from(JSON.stringify(body) || '').toString('base64') | |
} | |
} | |
module.exports = function (got) { | |
const inData = got.in.data; | |
console.log('edig: simple.js: data received:', inData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dns = require('dns'); | |
const pify = require('pify'); | |
//... | |
module.exports = function (got) { | |
const inData = got.in.data; | |
console.log('edig: simple.js: data received:', inData); | |
return inData.map(d => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"dag": { | |
"inputs":{ | |
"rpc":{ | |
"simple_rpc":{ | |
"methods": ["GET"], | |
"path": "/edig/txt/*", | |
"CORS":{} | |
} | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"dag": { | |
"inputs":{ | |
"rpc":{ | |
"search":{ | |
"methods": ["GET"], | |
"path": "/_search", | |
"CORS":{} | |
} | |
} | |
}, |