Really simple form-to-xhr requests with FormData
, Request
and onclick
<form id="form">
<input id="input" name="input" placeholder="" />
<input type="submit" onclick="submitForm(event)" />
</form>
import './addClass'; | |
import './removeClass'; | |
import './addAttribute'; | |
import './removeAttribute'; | |
export default var elements = (element) => { | |
return { | |
addClass: (className) => { return addClass(element, className) }, | |
removeClass: (className) => { return removeClass(element, className); }, |
/** | |
* This is an object | |
* where we can store methods | |
* that are accessible with a string | |
*/ | |
var conditional = { | |
humanities: () => |
Really simple form-to-xhr requests with FormData
, Request
and onclick
<form id="form">
<input id="input" name="input" placeholder="" />
<input type="submit" onclick="submitForm(event)" />
</form>
var findX = () => event.clientX - event.target.offsetLeft; | |
var findY = () => event.target.offsetTop - event.clientY; |
var given = function(object, property) { | |
var does = (property) => given(object, property); | |
var exist = () => { | |
if (!is(object).object) return false | |
!object.hasOwnProperty(property) | |
? false |
<block data-src="src" data-alt="hello"></block>
<button onclick="click(event)">
note: await
is not available in ie
in this xhr library, which offers a simple xhr
api and a request api using html data attributes, I used a pubsub
pattern to listen for events. Until IE
support is offered, this is a nice and agnostic client-side approach without needing polyfills or complicated build processes.
var events = {
events: [],
emit: function(event, response) { ... },
addEventListener: function(event, fn) { ... }
}
// type definitions needed | |
const scale = (scale: String, domain: Array<Number>, range: Array<any>) => d3[scale]().domain(domain).range(range) | |
const axis = (scale: D3Scale) => d3.axis(scale) | |
const data = new Set( | |
[], [], [], [] | |
); | |
for (const gridCoordinate of data) {} |
#!/usr/bin/env node | |
var express = require("express"); | |
var app = express(); | |
app.listen(process.env.EXPRESS_PORT || 3002, | |
"127.0.0.1", | |
function (error) { | |
if (error) process.exit(10); | |
}); |