Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import riot from 'riot';
// components
import '../tags/frost-login-form.tag';
import '../tags/frost-signup-form.tag';
import '../tags/frost-logout-button.tag';
import '../tags/frost-create-status-form.tag';
import '../tags/frost-post-status.tag';
import '../tags/frost-public-timeline.tag';
import '../tags/frost-applications.tag';
import '../tags/frost-create-application-form.tag';
const socket = io(); /* headのscriptタグからsocket.ioを読み込んで使用している(妥協) */
const obs = riot.observable();
const mountOption = {obs: obs, socket: socket};
let userId;
const elements = document.getElementsByName('frost-userId');
if(elements.length != 0) {
userId = elements.item(0).content;
}
socket.once('ready', (readyData) => {
if (userId != null) {
mountOption.userId = userId;
socket.emit('rest', {request: {
method: 'get', endpoint: `/users/${userId}`,
headers: {'x-api-version': 1.0},
}});
function EdgeStore() {
var self = riot.observable(this);
// Register store with RiotControl. All subsequent `trigger` and `on` method calls through
// RiotControl will be passed on to this store.
RiotControl.addStore(self);
// DATA STORE
self.edges = [];
// Utils
var _getEdge = Utils.getElement.bind(undefined, self.edges);
// Event listeners
var CALLS = Constants.calls;
var EVENTS = Constants.events;
var EMIT_CHANGE = EVENTS.EDGE_LIST_CHANGED;
self.on(CALLS.GET_ALL_EDGES, function(callback) {
constructor() {
console.log("Store base class constructor");
this.control = {};
riot.observable(this.control);
}
on() {
* mutaions.
* mutaion = a function which mutates the state.
* all mutation functions take two parameters which are `state` and `obj`.
* `state` will be TODO.
* `obj` will be TODO.
* @type {Object}
*/
this._mutations = ObjectAssign({}, _store.mutations);
/**
* functions to get data from states.
* @type {Object}
*/
this._getters = ObjectAssign({}, _store.getters);
riot.observable(this);
}
constructor(config = {}) {
assert(config.name, 'A form must have a name')
riot.observable(this)
this._config = config
this._inputs = config.inputs || {}
this._forms = config.forms || {}
this.model = config.model || {}
this.name = config.name
this._errors = {}
}
init: function () {
var self = this
self.route = {}
riot.observable(self.route)
riot.route(function (collection, id, action) {
var current = [collection]
if (id) current.push(id)
if (id && action) current.push(action)
self.route.collection = collection
self.route.id = id
self.route.action = action
self.path = current.join('/')
if (self.path === path.replace(':id', id)) {
self.update({show: true})
self.route.trigger('show')
} else {
self.update({show: false})
self.route.trigger('hide')
function App (state) {
this.state = state
this.events = riot.observable({})
this.scales = require('./scales.js')
this.render = require('./render.js')
this.route = require('./router.js')(this)
this.play = require('./player.js')
}
function App (state) {
this.state = state
this.events = riot.observable({})
this.scales = require('./scales.js')
this.render = require('./render.js')
this.route = require('./router.js')(this)
this.play = require('./player.js')
}
constructor(config = {}) {
riot.observable(this)
assert(config.name, 'An input must have a name')
this.config = config
this.setValue(config.value || this.defaultValue, {silent: true})
if (config.formName) {
this.formName = config.formName
}
}
return new Promise((resolve, reject) => {
if (url == null) {
return reject(new ReferenceError('missing argumets'));
}
const ws = new WebSocket2(url, [], { reconnectInterval: 3000 });
riot.observable(ws);
ws.addEventListener('error', (errorEvent) => { reject(errorEvent); });
ws.addEventListener('close', (closeEvent) => { reject(closeEvent); });
ws.addEventListener('open', () => {
resolve(ws);
});
});
}