-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
451 additions
and
126 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<!-- http://localhost:8000/simple-ejson-page.html --> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
|
||
<head> | ||
<title>simple e-json page</title> | ||
<link rel="shortcut icon" href="/../images/favicon.ico"/> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="stylesheet" href="/../css/normalize.css"> | ||
<link rel="stylesheet" href="/../css/main.css"> | ||
<script src="/../js/ehtml.bundle.min.js" type="text/javascript"></script> | ||
</head> | ||
|
||
<body class="main"> | ||
<div class="base"> | ||
<div class="profile-box"> | ||
<img class="ajax-icon" id="ajax-icon" src="/../images/ajax-icon.svg"/> | ||
<template | ||
is="e-json" | ||
data-src="/../profile?name=Amanda" | ||
data-ajax-icon="#ajax-icon" | ||
data-object-name="profileResponse" | ||
> | ||
<img class="photo" src="${profileResponse.body.photo}"/> | ||
<div class="user-info"> | ||
<div class="name" data-text="${profileResponse.body.name}"></div> | ||
<div class="email" data-text="${profileResponse.body.email}"></div> | ||
<div class="other-details"> | ||
<div data-text="Age: ${profileResponse.body.age}"></div> | ||
<div data-text="Country: ${profileResponse.body.country}"></div> | ||
<div data-text="Profession: ${profileResponse.body.profession}"></div> | ||
</div> | ||
</div> | ||
</template> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
'use strict'; | ||
|
||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
|
||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
|
||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
|
||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
|
||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
|
||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
|
||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
|
||
var E = require('./E'); | ||
|
||
var _require = require('./../cutie/exports'), | ||
as = _require.as; | ||
|
||
var _require2 = require('./../async-dom/exports'), | ||
FirstParsedElmSelector = _require2.FirstParsedElmSelector, | ||
PreparedProgressBar = _require2.PreparedProgressBar, | ||
ShownElement = _require2.ShownElement, | ||
HiddenElement = _require2.HiddenElement; | ||
|
||
var _require3 = require('./../async-ajax/exports'), | ||
ResponseFromAjaxRequest = _require3.ResponseFromAjaxRequest, | ||
ResponseBody = _require3.ResponseBody, | ||
ResponseHeaders = _require3.ResponseHeaders, | ||
ResponseStatusCode = _require3.ResponseStatusCode, | ||
JSResponseByHTTPReponseComponents = _require3.JSResponseByHTTPReponseComponents; | ||
|
||
var _require4 = require('./../async-object/exports'), | ||
CreatedOptions = _require4.CreatedOptions; | ||
|
||
var _require5 = require('./../async-json/exports'), | ||
ParsedJSON = _require5.ParsedJSON; | ||
|
||
var _require6 = require('./../async-string/exports'), | ||
StringFromBuffer = _require6.StringFromBuffer; | ||
|
||
var _require7 = require('./../events/exports'), | ||
ShowProgressEvent = _require7.ShowProgressEvent; | ||
|
||
var _require8 = require('./../async-dom/exports'), | ||
ElementWithMappedObject = _require8.ElementWithMappedObject; | ||
|
||
var E_JSON_TEMPLATE = | ||
/*#__PURE__*/ | ||
function (_E) { | ||
_inherits(E_JSON_TEMPLATE, _E); | ||
|
||
function E_JSON_TEMPLATE(node) { | ||
_classCallCheck(this, E_JSON_TEMPLATE); | ||
|
||
return _possibleConstructorReturn(this, _getPrototypeOf(E_JSON_TEMPLATE).call(this, node)); | ||
} | ||
|
||
_createClass(E_JSON_TEMPLATE, [{ | ||
key: "activate", | ||
value: function activate() { | ||
new ShownElement(new FirstParsedElmSelector(this.node.getAttribute('data-ajax-icon')).as('AJAX_ICON')).after(new PreparedProgressBar(new FirstParsedElmSelector(this.node.getAttribute('data-progress-bar'))).as('PROGRESS_BAR').after(new ResponseFromAjaxRequest(new CreatedOptions('url', this.node.getAttribute('data-src'), 'method', 'GET', 'headers', new ParsedJSON(this.node.getAttribute('data-request-headers') || '{}'), 'progressEvent', new ShowProgressEvent(as('PROGRESS_BAR')))).as('RESPONSE').after(new HiddenElement(as('AJAX_ICON')).after(new ElementWithMappedObject(this.node, new JSResponseByHTTPReponseComponents(new ParsedJSON(new StringFromBuffer(new ResponseBody(as('RESPONSE')))), new ResponseHeaders(as('RESPONSE')), new ResponseStatusCode(as('RESPONSE')))))))).call(); | ||
} | ||
}]); | ||
|
||
return E_JSON_TEMPLATE; | ||
}(E); | ||
|
||
module.exports = E_JSON_TEMPLATE; |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
'use strict' | ||
|
||
const E = require('./E') | ||
const { as } = require('./../cutie/exports') | ||
const { FirstParsedElmSelector, PreparedProgressBar, ShownElement, HiddenElement } = require('./../async-dom/exports') | ||
const { ResponseFromAjaxRequest, ResponseBody, ResponseHeaders, ResponseStatusCode, JSResponseByHTTPReponseComponents } = require('./../async-ajax/exports') | ||
const { CreatedOptions } = require('./../async-object/exports') | ||
const { ParsedJSON } = require('./../async-json/exports') | ||
const { StringFromBuffer } = require('./../async-string/exports') | ||
const { ShowProgressEvent } = require('./../events/exports') | ||
const { ElementWithMappedObject } = require('./../async-dom/exports') | ||
|
||
class E_JSON_TEMPLATE extends E { | ||
constructor (node) { | ||
super(node) | ||
} | ||
|
||
activate () { | ||
new ShownElement( | ||
new FirstParsedElmSelector( | ||
this.node.getAttribute('data-ajax-icon') | ||
).as('AJAX_ICON') | ||
).after( | ||
new PreparedProgressBar( | ||
new FirstParsedElmSelector( | ||
this.node.getAttribute('data-progress-bar') | ||
) | ||
).as('PROGRESS_BAR').after( | ||
new ResponseFromAjaxRequest( | ||
new CreatedOptions( | ||
'url', this.node.getAttribute('data-src'), | ||
'method', 'GET', | ||
'headers', new ParsedJSON( | ||
this.node.getAttribute('data-request-headers') || '{}' | ||
), | ||
'progressEvent', new ShowProgressEvent( | ||
as('PROGRESS_BAR') | ||
) | ||
) | ||
).as('RESPONSE').after( | ||
new HiddenElement( | ||
as('AJAX_ICON') | ||
).after( | ||
new ElementWithMappedObject( | ||
this.node, | ||
new JSResponseByHTTPReponseComponents( | ||
new ParsedJSON( | ||
new StringFromBuffer( | ||
new ResponseBody( | ||
as('RESPONSE') | ||
) | ||
) | ||
), | ||
new ResponseHeaders( | ||
as('RESPONSE') | ||
), | ||
new ResponseStatusCode( | ||
as('RESPONSE') | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
).call() | ||
} | ||
} | ||
|
||
module.exports = E_JSON_TEMPLATE |
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
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