code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
_filter(source) {
const filterObj = this.filterObj;
this.filteredData = source.filter((row, r) => {
let valid = true;
let filterVal;
for (const key in filterObj) {
let targetVal = row[key];
if (targetVal === null || targetVal === undefined) {
targetVal = '';
}
switch (filterObj[key].type) {
case Const.FILTER_TYPE.NUMBER: {
filterVal = filterObj[key].value.number;
break;
}
case Const.FILTER_TYPE.CUSTOM: {
filterVal = (typeof filterObj[key].value === 'object') ?
undefined :
(typeof filterObj[key].value === 'string') ?
filterObj[key].value.toLowerCase() :
filterObj[key].value;
break;
}
case Const.FILTER_TYPE.DATE: {
filterVal = filterObj[key].value.date;
break;
}
case Const.FILTER_TYPE.REGEX: {
filterVal = filterObj[key].value;
break;
}
case Const.FILTER_TYPE.ARRAY: {
filterVal = filterObj[key].value;
if (!Array.isArray(filterVal)) {
throw new Error('Value must be an Array');
}
break;
}
default: {
filterVal = filterObj[key].value;
if (filterVal === undefined) {
// Support old filter
filterVal = filterObj[key];
}
break;
}
}
let format, filterFormatted, formatExtraData, filterValue;
if (this.colInfos[key]) {
format = this.colInfos[key].format;
filterFormatted = this.colInfos[key].filterFormatted;
formatExtraData = this.colInfos[key].formatExtraData;
filterValue = this.colInfos[key].filterValue;
if (filterFormatted && format) {
targetVal = format(row[key], row, formatExtraData, r);
} else if (filterValue) {
targetVal = filterValue(row[key], row);
}
}
switch (filterObj[key].type) {
case Const.FILTER_TYPE.NUMBER: {
valid = this.filterNumber(targetVal, filterVal, filterObj[key].value.comparator);
break;
}
case Const.FILTER_TYPE.DATE: {
valid = this.filterDate(targetVal, filterVal, filterObj[key].value.comparator);
break;
}
case Const.FILTER_TYPE.REGEX: {
valid = this.filterRegex(targetVal, filterVal);
break;
}
case Const.FILTER_TYPE.CUSTOM: {
const cond = filterObj[key].props ? filterObj[key].props.cond : Const.FILTER_COND_LIKE;
valid = this.filterCustom(targetVal, filterVal, filterObj[key].value, cond);
break;
}
case Const.FILTER_TYPE.ARRAY: {
valid = this.filterArray(targetVal, filterVal);
break;
}
default: {
if (filterObj[key].type === Const.FILTER_TYPE.SELECT &&
filterFormatted && filterFormatted && format) {
filterVal = format(filterVal, row, formatExtraData, r);
}
const cond = filterObj[key].props ? filterObj[key].props.cond : Const.FILTER_COND_LIKE;
valid = this.filterText(targetVal, filterVal, cond);
break;
}
}
if (!valid) {
break;
}
}
return valid;
});
this.isOnFilter = true;
}
|
Filter if targetVal is contained in filterVal.
|
_filter
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
_search(source) {
let searchTextArray;
if (this.multiColumnSearch || !this.strictSearch) {
// ignore leading and trailing whitespaces
searchTextArray = this.searchText.trim().toLowerCase().split(/\s+/);
} else {
searchTextArray = [ this.searchText.toLowerCase() ];
}
const searchTermCount = searchTextArray.length;
const multipleTerms = searchTermCount > 1;
const nonStrictMultiCol = multipleTerms && !this.strictSearch && this.multiColumnSearch;
const nonStrictSingleCol = multipleTerms && !this.strictSearch && !this.multiColumnSearch;
this.filteredData = source.filter((row, r) => {
const keys = Object.keys(row);
// only clone array if necessary
let searchTerms = multipleTerms ? searchTextArray.slice() : searchTextArray;
// for loops are ugly, but performance matters here.
// And you cant break from a forEach.
// http://jsperf.com/for-vs-foreach/66
for (let i = 0, keysLength = keys.length; i < keysLength; i++) {
const key = keys[i];
const colInfo = this.colInfos[key];
if (colInfo && colInfo.searchable) {
const {
format,
filterFormatted,
filterValue,
formatExtraData
} = colInfo;
let targetVal;
if (filterFormatted && format) {
targetVal = format(row[key], row, formatExtraData, r);
} else if (filterValue) {
targetVal = filterValue(row[key], row);
} else {
targetVal = row[key];
}
if (targetVal !== null && typeof targetVal !== 'undefined') {
targetVal = targetVal.toString().toLowerCase();
if (nonStrictSingleCol && searchTermCount > searchTerms.length) {
// reset search terms for single column search
searchTerms = searchTextArray.slice();
}
for (let j = searchTerms.length - 1; j > -1; j--) {
if (targetVal.indexOf(searchTerms[j]) !== -1) {
if (nonStrictMultiCol || searchTerms.length === 1) {
// match found: the last or only one
return true;
}
// match found: but there are more search terms to check for
searchTerms.splice(j, 1);
} else if (!this.multiColumnSearch) {
// one of the search terms was not found in this column
break;
}
}
}
}
}
return false;
});
this.isOnFilter = true;
}
|
Filter if targetVal is contained in filterVal.
|
_search
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
_sort(arr) {
if (this.sortList.length === 0 || typeof(this.sortList[0]) === 'undefined') {
return arr;
}
arr.sort((a, b) => {
let result = 0;
for (let i = 0; i < this.sortList.length; i++) {
const sortDetails = this.sortList[i];
const isDesc = sortDetails.order.toLowerCase() === Const.SORT_DESC;
const { sortFunc, sortFuncExtraData } = this.colInfos[sortDetails.sortField];
if (sortFunc) {
result = sortFunc(a, b, sortDetails.order, sortDetails.sortField, sortFuncExtraData);
} else {
const valueA = a[sortDetails.sortField] == null ? '' : a[sortDetails.sortField];
const valueB = b[sortDetails.sortField] == null ? '' : b[sortDetails.sortField];
if (isDesc) {
if (typeof valueB === 'string') {
result = valueB.localeCompare(valueA);
} else {
result = valueA > valueB ? -1 : ((valueA < valueB) ? 1 : 0);
}
} else {
if (typeof valueA === 'string') {
result = valueA.localeCompare(valueB);
} else {
result = valueA < valueB ? -1 : ((valueA > valueB) ? 1 : 0);
}
}
}
if (result !== 0) {
return result;
}
}
return result;
});
return arr;
}
|
Filter if targetVal is contained in filterVal.
|
_sort
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
getDataIgnoringPagination() {
return this.getCurrentDisplayData();
}
|
Filter if targetVal is contained in filterVal.
|
getDataIgnoringPagination
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
get() {
const _data = this.getCurrentDisplayData();
if (_data.length === 0) return _data;
const remote = typeof this.remote === 'function' ?
(this.remote(Const.REMOTE))[Const.REMOTE_PAGE] : this.remote;
if (remote || !this.enablePagination) {
return _data;
} else {
const result = [];
for (let i = this.pageObj.start; i <= this.pageObj.end; i++) {
result.push(_data[i]);
if (i + 1 === _data.length) break;
}
return result;
}
}
|
Filter if targetVal is contained in filterVal.
|
get
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
getKeyField() {
return this.keyField;
}
|
Filter if targetVal is contained in filterVal.
|
getKeyField
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
getDataNum() {
return this.getCurrentDisplayData().length;
}
|
Filter if targetVal is contained in filterVal.
|
getDataNum
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
isChangedPage() {
return this.pageObj.start && this.pageObj.end ? true : false;
}
|
Filter if targetVal is contained in filterVal.
|
isChangedPage
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
isEmpty() {
return (this.data.length === 0 ||
this.data === null ||
this.data === undefined);
}
|
Filter if targetVal is contained in filterVal.
|
isEmpty
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
getAllRowkey() {
return this.data.map(row => {
return row[this.keyField];
});
}
|
Filter if targetVal is contained in filterVal.
|
getAllRowkey
|
javascript
|
AllenFang/react-bootstrap-table
|
src/store/TableDataStore.js
|
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js
|
MIT
|
function Strategy(options, verify) {
if (typeof options == 'function') {
verify = options;
options = {};
}
if (!verify) { throw new TypeError('HTTPBearerStrategy requires a verify function'); }
passport.Strategy.call(this);
/** The name of the strategy, set to `'bearer'`.
*
* @type {string}
* @readonly
*/
this.name = 'bearer';
this._verify = verify;
this._realm = options.realm || 'Users';
if (options.scope) {
this._scope = (Array.isArray(options.scope)) ? options.scope : [ options.scope ];
}
this._passReqToCallback = options.passReqToCallback;
}
|
Create a new `Strategy` object.
@classdesc This `Strategy` authenticates HTTP requests that use the Bearer
authentication scheme, as specified by {@link https://www.rfc-editor.org/rfc/rfc6750 RFC 6750}.
The bearer token credential can be sent in the HTTP request in one of three
different ways. Preferably, the token is sent in the "Authorization" header
field:
```http
GET /resource HTTP/1.1
Host: server.example.com
Authorization: Bearer mF_9.B5f-4.1JqM
```
Alternatively, the token can be sent in a form-encoded body, using the
`access_token` parameter:
```http
POST /resource HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded
access_token=mF_9.B5f-4.1JqM
```
Or, in the URL, using the `access_token` query parameter:
```http
GET /resource?access_token=mF_9.B5f-4.1JqM HTTP/1.1
Host: server.example.com
```
@public
@class
@augments base.Strategy
@param {Object} [options]
@param {string} [options.realm='Users'] - Value indicating the protection
space over which credentials are valid.
@param {string} [options.scope] - Value indicating required scope needed to
access protected resources.
@param {boolean} [options.passReqToCallback=false] - When `true`, the
`verify` function receives the request object as the first argument,
in accordance with the `{@link Strategy~verifyWithReqFn}` signature.
@param {Strategy~verifyFn|Strategy~verifyWithReqFn} verify - Function which
verifies access token.
@example
var BearerStrategy = require('passport-http-bearer').Strategy;
new BearerStrategy(function(token, cb) {
tokens.findOne({ value: token }, function(err, claims) {
if (err) { return cb(err); }
if (!claims) { return cb(null, false); }
users.findOne({ id: claims.userID }, function (err, user) {
if (err) { return cb(err); }
if (!user) { return cb(null, false); }
return cb(null, user, { scope: claims.scope });
});
});
});
|
Strategy
|
javascript
|
jaredhanson/passport-http-bearer
|
lib/strategy.js
|
https://github.com/jaredhanson/passport-http-bearer/blob/master/lib/strategy.js
|
MIT
|
function verified(err, user, info) {
if (err) { return self.error(err); }
if (!user) {
if (typeof info == 'string') {
info = { message: info }
}
info = info || {};
return self.fail(self._challenge('invalid_token', info.message));
}
self.success(user, info);
}
|
Authenticate request by verifying access token.
When a bearer token is sent in the request, it will be parsed and the verify
function will be called to verify the token and authenticate the request. If
a token is not present, authentication will fail with the appropriate
challenge and status code.
This function is protected, and should not be called directly. Instead,
use `passport.authenticate()` middleware and specify the {@link Strategy#name `name`}
of this strategy and any options.
@protected
@param {http.IncomingMessage} req - The Node.js {@link https://nodejs.org/api/http.html#class-httpincomingmessage `IncomingMessage`}
object.
@example
passport.authenticate('bearer');
|
verified
|
javascript
|
jaredhanson/passport-http-bearer
|
lib/strategy.js
|
https://github.com/jaredhanson/passport-http-bearer/blob/master/lib/strategy.js
|
MIT
|
function _Utils_cmp(x, y, ord)
{
if (typeof x !== 'object')
{
return x === y ? /*EQ*/ 0 : x < y ? /*LT*/ -1 : /*GT*/ 1;
}
/**/
if (x instanceof String)
{
var a = x.valueOf();
var b = y.valueOf();
return a === b ? 0 : a < b ? -1 : 1;
}
//*/
/**_UNUSED/
if (typeof x.$ === 'undefined')
//*/
/**/
if (x.$[0] === '#')
//*/
{
return (ord = _Utils_cmp(x.a, y.a))
? ord
: (ord = _Utils_cmp(x.b, y.b))
? ord
: _Utils_cmp(x.c, y.c);
}
// traverse conses until end of a list or a mismatch
for (; x.b && y.b && !(ord = _Utils_cmp(x.a, y.a)); x = x.b, y = y.b) {} // WHILE_CONSES
return ord || (x.b ? /*GT*/ 1 : y.b ? /*LT*/ -1 : /*EQ*/ 0);
}
|
_UNUSED/
if (x.$ < 0)
{
x = $elm$core$Dict$toList(x);
y = $elm$core$Dict$toList(y);
}
//
|
_Utils_cmp
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_succeed(msg)
{
return {
$: 0,
a: msg
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_succeed
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_fail(msg)
{
return {
$: 1,
a: msg
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_fail
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_decodePrim(decoder)
{
return { $: 2, b: decoder };
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_decodePrim
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_decodeKeyValuePairs(decoder)
{
return {
$: 8,
b: decoder
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_decodeKeyValuePairs
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_mapMany(f, decoders)
{
return {
$: 9,
f: f,
g: decoders
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_mapMany
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_oneOf(decoders)
{
return {
$: 11,
g: decoders
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_oneOf
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_runHelp(decoder, value)
{
switch (decoder.$)
{
case 2:
return decoder.b(value);
case 5:
return (value === null)
? $elm$core$Result$Ok(decoder.c)
: _Json_expecting('null', value);
case 3:
if (!_Json_isArray(value))
{
return _Json_expecting('a LIST', value);
}
return _Json_runArrayDecoder(decoder.b, value, _List_fromArray);
case 4:
if (!_Json_isArray(value))
{
return _Json_expecting('an ARRAY', value);
}
return _Json_runArrayDecoder(decoder.b, value, _Json_toElmArray);
case 6:
var field = decoder.d;
if (typeof value !== 'object' || value === null || !(field in value))
{
return _Json_expecting('an OBJECT with a field named `' + field + '`', value);
}
var result = _Json_runHelp(decoder.b, value[field]);
return ($elm$core$Result$isOk(result)) ? result : $elm$core$Result$Err(A2($elm$json$Json$Decode$Field, field, result.a));
case 7:
var index = decoder.e;
if (!_Json_isArray(value))
{
return _Json_expecting('an ARRAY', value);
}
if (index >= value.length)
{
return _Json_expecting('a LONGER array. Need index ' + index + ' but only see ' + value.length + ' entries', value);
}
var result = _Json_runHelp(decoder.b, value[index]);
return ($elm$core$Result$isOk(result)) ? result : $elm$core$Result$Err(A2($elm$json$Json$Decode$Index, index, result.a));
case 8:
if (typeof value !== 'object' || value === null || _Json_isArray(value))
{
return _Json_expecting('an OBJECT', value);
}
var keyValuePairs = _List_Nil;
// TODO test perf of Object.keys and switch when support is good enough
for (var key in value)
{
if (value.hasOwnProperty(key))
{
var result = _Json_runHelp(decoder.b, value[key]);
if (!$elm$core$Result$isOk(result))
{
return $elm$core$Result$Err(A2($elm$json$Json$Decode$Field, key, result.a));
}
keyValuePairs = _List_Cons(_Utils_Tuple2(key, result.a), keyValuePairs);
}
}
return $elm$core$Result$Ok($elm$core$List$reverse(keyValuePairs));
case 9:
var answer = decoder.f;
var decoders = decoder.g;
for (var i = 0; i < decoders.length; i++)
{
var result = _Json_runHelp(decoders[i], value);
if (!$elm$core$Result$isOk(result))
{
return result;
}
answer = answer(result.a);
}
return $elm$core$Result$Ok(answer);
case 10:
var result = _Json_runHelp(decoder.b, value);
return (!$elm$core$Result$isOk(result))
? result
: _Json_runHelp(decoder.h(result.a), value);
case 11:
var errors = _List_Nil;
for (var temp = decoder.g; temp.b; temp = temp.b) // WHILE_CONS
{
var result = _Json_runHelp(temp.a, value);
if ($elm$core$Result$isOk(result))
{
return result;
}
errors = _List_Cons(result.a, errors);
}
return $elm$core$Result$Err($elm$json$Json$Decode$OneOf($elm$core$List$reverse(errors)));
case 1:
return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, decoder.a, _Json_wrap(value)));
case 0:
return $elm$core$Result$Ok(decoder.a);
}
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_runHelp
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_runArrayDecoder(decoder, value, toElmValue)
{
var len = value.length;
var array = new Array(len);
for (var i = 0; i < len; i++)
{
var result = _Json_runHelp(decoder, value[i]);
if (!$elm$core$Result$isOk(result))
{
return $elm$core$Result$Err(A2($elm$json$Json$Decode$Index, i, result.a));
}
array[i] = result.a;
}
return $elm$core$Result$Ok(toElmValue(array));
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_runArrayDecoder
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_isArray(value)
{
return Array.isArray(value) || (typeof FileList !== 'undefined' && value instanceof FileList);
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_isArray
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_toElmArray(array)
{
return A2($elm$core$Array$initialize, array.length, function(i) { return array[i]; });
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_toElmArray
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_expecting(type, value)
{
return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, 'Expecting ' + type, _Json_wrap(value)));
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_expecting
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_equality(x, y)
{
if (x === y)
{
return true;
}
if (x.$ !== y.$)
{
return false;
}
switch (x.$)
{
case 0:
case 1:
return x.a === y.a;
case 2:
return x.b === y.b;
case 5:
return x.c === y.c;
case 3:
case 4:
case 8:
return _Json_equality(x.b, y.b);
case 6:
return x.d === y.d && _Json_equality(x.b, y.b);
case 7:
return x.e === y.e && _Json_equality(x.b, y.b);
case 9:
return x.f === y.f && _Json_listEquality(x.g, y.g);
case 10:
return x.h === y.h && _Json_equality(x.b, y.b);
case 11:
return _Json_listEquality(x.g, y.g);
}
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_equality
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_listEquality(aDecoders, bDecoders)
{
var len = aDecoders.length;
if (len !== bDecoders.length)
{
return false;
}
for (var i = 0; i < len; i++)
{
if (!_Json_equality(aDecoders[i], bDecoders[i]))
{
return false;
}
}
return true;
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_listEquality
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Json_addEntry(func)
{
return F2(function(entry, array)
{
array.push(_Json_unwrap(func(entry)));
return array;
});
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Json_addEntry
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_succeed(value)
{
return {
$: 0,
a: value
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_succeed
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_fail(error)
{
return {
$: 1,
a: error
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_fail
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_binding(callback)
{
return {
$: 2,
b: callback,
c: null
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_binding
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_receive(callback)
{
return {
$: 5,
b: callback
};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_receive
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_rawSpawn(task)
{
var proc = {
$: 0,
e: _Scheduler_guid++,
f: task,
g: null,
h: []
};
_Scheduler_enqueue(proc);
return proc;
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_rawSpawn
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_spawn(task)
{
return _Scheduler_binding(function(callback) {
callback(_Scheduler_succeed(_Scheduler_rawSpawn(task)));
});
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_spawn
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_rawSend(proc, msg)
{
proc.h.push(msg);
_Scheduler_enqueue(proc);
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_rawSend
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_kill(proc)
{
return _Scheduler_binding(function(callback) {
var task = proc.f;
if (task.$ === 2 && task.c)
{
task.c();
}
proc.f = null;
callback(_Scheduler_succeed(_Utils_Tuple0));
});
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_kill
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_enqueue(proc)
{
_Scheduler_queue.push(proc);
if (_Scheduler_working)
{
return;
}
_Scheduler_working = true;
while (proc = _Scheduler_queue.shift())
{
_Scheduler_step(proc);
}
_Scheduler_working = false;
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_enqueue
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Scheduler_step(proc)
{
while (proc.f)
{
var rootTag = proc.f.$;
if (rootTag === 0 || rootTag === 1)
{
while (proc.g && proc.g.$ !== rootTag)
{
proc.g = proc.g.i;
}
if (!proc.g)
{
return;
}
proc.f = proc.g.b(proc.f.a);
proc.g = proc.g.i;
}
else if (rootTag === 2)
{
proc.f.c = proc.f.b(function(newRoot) {
proc.f = newRoot;
_Scheduler_enqueue(proc);
});
return;
}
else if (rootTag === 5)
{
if (proc.h.length === 0)
{
return;
}
proc.f = proc.f.b(proc.h.shift());
}
else // if (rootTag === 3 || rootTag === 4)
{
proc.g = {
$: rootTag === 3 ? 0 : 1,
b: proc.f.b,
i: proc.g
};
proc.f = proc.f.d;
}
}
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Scheduler_step
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Process_sleep(time)
{
return _Scheduler_binding(function(callback) {
var id = setTimeout(function() {
callback(_Scheduler_succeed(_Utils_Tuple0));
}, time);
return function() { clearTimeout(id); };
});
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Process_sleep
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Platform_initialize(flagDecoder, args, init, update, subscriptions, stepperBuilder)
{
var result = A2(_Json_run, flagDecoder, _Json_wrap(args ? args['flags'] : undefined));
$elm$core$Result$isOk(result) || _Debug_crash(2 /**/, _Json_errorToString(result.a) /**/);
var managers = {};
result = init(result.a);
var model = result.a;
var stepper = stepperBuilder(sendToApp, model);
var ports = _Platform_setupEffects(managers, sendToApp);
function sendToApp(msg, viewMetadata)
{
result = A2(update, msg, model);
stepper(model = result.a, viewMetadata);
_Platform_dispatchEffects(managers, result.b, subscriptions(model));
}
_Platform_dispatchEffects(managers, result.b, subscriptions(model));
return ports ? { ports: ports } : {};
}
|
/
function _Json_errorToString(error)
{
return $elm$json$Json$Decode$errorToString(error);
}
//
|
_Platform_initialize
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_text(string)
{
return {
$: 0,
a: string
};
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_text
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_custom(factList, model, render, diff)
{
return {
$: 3,
d: _VirtualDom_organizeFacts(factList),
g: model,
h: render,
i: diff
};
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_custom
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_thunk(refs, thunk)
{
return {
$: 5,
l: refs,
m: thunk,
k: undefined
};
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_thunk
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_noScript(tag)
{
return tag == 'script' ? 'p' : tag;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_noScript
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_noOnOrFormAction(key)
{
return /^(on|formAction$)/i.test(key) ? 'data-' + key : key;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_noOnOrFormAction
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_noInnerHtmlOrFormAction(key)
{
return key == 'innerHTML' || key == 'formAction' ? 'data-' + key : key;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_noInnerHtmlOrFormAction
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_noJavaScriptUri_UNUSED(value)
{
return /^javascript:/i.test(value.replace(/\s/g,'')) ? '' : value;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_noJavaScriptUri_UNUSED
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_noJavaScriptUri(value)
{
return /^javascript:/i.test(value.replace(/\s/g,''))
? 'javascript:alert("This is an XSS vector. Please use ports or web components instead.")'
: value;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_noJavaScriptUri
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_noJavaScriptOrHtmlUri_UNUSED(value)
{
return /^\s*(javascript:|data:text\/html)/i.test(value) ? '' : value;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_noJavaScriptOrHtmlUri_UNUSED
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_noJavaScriptOrHtmlUri(value)
{
return /^\s*(javascript:|data:text\/html)/i.test(value)
? 'javascript:alert("This is an XSS vector. Please use ports or web components instead.")'
: value;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_noJavaScriptOrHtmlUri
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_mapHandler(func, handler)
{
var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler);
// 0 = Normal
// 1 = MayStopPropagation
// 2 = MayPreventDefault
// 3 = Custom
return {
$: handler.$,
a:
!tag
? A2($elm$json$Json$Decode$map, func, handler.a)
:
A3($elm$json$Json$Decode$map2,
tag < 3
? _VirtualDom_mapEventTuple
: _VirtualDom_mapEventRecord,
$elm$json$Json$Decode$succeed(func),
handler.a
)
};
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_mapHandler
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_organizeFacts(factList)
{
for (var facts = {}; factList.b; factList = factList.b) // WHILE_CONS
{
var entry = factList.a;
var tag = entry.$;
var key = entry.n;
var value = entry.o;
if (tag === 'a2')
{
(key === 'className')
? _VirtualDom_addClass(facts, key, _Json_unwrap(value))
: facts[key] = _Json_unwrap(value);
continue;
}
var subFacts = facts[tag] || (facts[tag] = {});
(tag === 'a3' && key === 'class')
? _VirtualDom_addClass(subFacts, key, value)
: subFacts[key] = value;
}
return facts;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_organizeFacts
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_addClass(object, key, newClass)
{
var classes = object[key];
object[key] = classes ? classes + ' ' + newClass : newClass;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_addClass
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_render(vNode, eventNode)
{
var tag = vNode.$;
if (tag === 5)
{
return _VirtualDom_render(vNode.k || (vNode.k = vNode.m()), eventNode);
}
if (tag === 0)
{
return _VirtualDom_doc.createTextNode(vNode.a);
}
if (tag === 4)
{
var subNode = vNode.k;
var tagger = vNode.j;
while (subNode.$ === 4)
{
typeof tagger !== 'object'
? tagger = [tagger, subNode.j]
: tagger.push(subNode.j);
subNode = subNode.k;
}
var subEventRoot = { j: tagger, p: eventNode };
var domNode = _VirtualDom_render(subNode, subEventRoot);
domNode.elm_event_node_ref = subEventRoot;
return domNode;
}
if (tag === 3)
{
var domNode = vNode.h(vNode.g);
_VirtualDom_applyFacts(domNode, eventNode, vNode.d);
return domNode;
}
// at this point `tag` must be 1 or 2
var domNode = vNode.f
? _VirtualDom_doc.createElementNS(vNode.f, vNode.c)
: _VirtualDom_doc.createElement(vNode.c);
if (_VirtualDom_divertHrefToApp && vNode.c == 'a')
{
domNode.addEventListener('click', _VirtualDom_divertHrefToApp(domNode));
}
_VirtualDom_applyFacts(domNode, eventNode, vNode.d);
for (var kids = vNode.e, i = 0; i < kids.length; i++)
{
_VirtualDom_appendChild(domNode, _VirtualDom_render(tag === 1 ? kids[i] : kids[i].b, eventNode));
}
return domNode;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_render
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyFacts(domNode, eventNode, facts)
{
for (var key in facts)
{
var value = facts[key];
key === 'a1'
? _VirtualDom_applyStyles(domNode, value)
:
key === 'a0'
? _VirtualDom_applyEvents(domNode, eventNode, value)
:
key === 'a3'
? _VirtualDom_applyAttrs(domNode, value)
:
key === 'a4'
? _VirtualDom_applyAttrsNS(domNode, value)
:
((key !== 'value' && key !== 'checked') || domNode[key] !== value) && (domNode[key] = value);
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyFacts
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyStyles(domNode, styles)
{
var domNodeStyle = domNode.style;
for (var key in styles)
{
domNodeStyle[key] = styles[key];
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyStyles
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyAttrs(domNode, attrs)
{
for (var key in attrs)
{
var value = attrs[key];
typeof value !== 'undefined'
? domNode.setAttribute(key, value)
: domNode.removeAttribute(key);
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyAttrs
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyAttrsNS(domNode, nsAttrs)
{
for (var key in nsAttrs)
{
var pair = nsAttrs[key];
var namespace = pair.f;
var value = pair.o;
typeof value !== 'undefined'
? domNode.setAttributeNS(namespace, key, value)
: domNode.removeAttributeNS(namespace, key);
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyAttrsNS
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyEvents(domNode, eventNode, events)
{
var allCallbacks = domNode.elmFs || (domNode.elmFs = {});
for (var key in events)
{
var newHandler = events[key];
var oldCallback = allCallbacks[key];
if (!newHandler)
{
domNode.removeEventListener(key, oldCallback);
allCallbacks[key] = undefined;
continue;
}
if (oldCallback)
{
var oldHandler = oldCallback.q;
if (oldHandler.$ === newHandler.$)
{
oldCallback.q = newHandler;
continue;
}
domNode.removeEventListener(key, oldCallback);
}
oldCallback = _VirtualDom_makeCallback(eventNode, newHandler);
domNode.addEventListener(key, oldCallback,
_VirtualDom_passiveSupported
&& { passive: $elm$virtual_dom$VirtualDom$toHandlerInt(newHandler) < 2 }
);
allCallbacks[key] = oldCallback;
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyEvents
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_makeCallback(eventNode, initialHandler)
{
function callback(event)
{
var handler = callback.q;
var result = _Json_runHelp(handler.a, event);
if (!$elm$core$Result$isOk(result))
{
return;
}
var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler);
// 0 = Normal
// 1 = MayStopPropagation
// 2 = MayPreventDefault
// 3 = Custom
var value = result.a;
var message = !tag ? value : tag < 3 ? value.a : value.message;
var stopPropagation = tag == 1 ? value.b : tag == 3 && value.stopPropagation;
var currentEventNode = (
stopPropagation && event.stopPropagation(),
(tag == 2 ? value.b : tag == 3 && value.preventDefault) && event.preventDefault(),
eventNode
);
var tagger;
var i;
while (tagger = currentEventNode.j)
{
if (typeof tagger == 'function')
{
message = tagger(message);
}
else
{
for (var i = tagger.length; i--; )
{
message = tagger[i](message);
}
}
currentEventNode = currentEventNode.p;
}
currentEventNode(message, stopPropagation); // stopPropagation implies isSync
}
callback.q = initialHandler;
return callback;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_makeCallback
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function callback(event)
{
var handler = callback.q;
var result = _Json_runHelp(handler.a, event);
if (!$elm$core$Result$isOk(result))
{
return;
}
var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler);
// 0 = Normal
// 1 = MayStopPropagation
// 2 = MayPreventDefault
// 3 = Custom
var value = result.a;
var message = !tag ? value : tag < 3 ? value.a : value.message;
var stopPropagation = tag == 1 ? value.b : tag == 3 && value.stopPropagation;
var currentEventNode = (
stopPropagation && event.stopPropagation(),
(tag == 2 ? value.b : tag == 3 && value.preventDefault) && event.preventDefault(),
eventNode
);
var tagger;
var i;
while (tagger = currentEventNode.j)
{
if (typeof tagger == 'function')
{
message = tagger(message);
}
else
{
for (var i = tagger.length; i--; )
{
message = tagger[i](message);
}
}
currentEventNode = currentEventNode.p;
}
currentEventNode(message, stopPropagation); // stopPropagation implies isSync
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
callback
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_equalEvents(x, y)
{
return x.$ == y.$ && _Json_equality(x.a, y.a);
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_equalEvents
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_diff(x, y)
{
var patches = [];
_VirtualDom_diffHelp(x, y, patches, 0);
return patches;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_diff
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_pushPatch(patches, type, index, data)
{
var patch = {
$: type,
r: index,
s: data,
t: undefined,
u: undefined
};
patches.push(patch);
return patch;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_pushPatch
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_diffHelp(x, y, patches, index)
{
if (x === y)
{
return;
}
var xType = x.$;
var yType = y.$;
// Bail if you run into different types of nodes. Implies that the
// structure has changed significantly and it's not worth a diff.
if (xType !== yType)
{
if (xType === 1 && yType === 2)
{
y = _VirtualDom_dekey(y);
yType = 1;
}
else
{
_VirtualDom_pushPatch(patches, 0, index, y);
return;
}
}
// Now we know that both nodes are the same $.
switch (yType)
{
case 5:
var xRefs = x.l;
var yRefs = y.l;
var i = xRefs.length;
var same = i === yRefs.length;
while (same && i--)
{
same = xRefs[i] === yRefs[i];
}
if (same)
{
y.k = x.k;
return;
}
y.k = y.m();
var subPatches = [];
_VirtualDom_diffHelp(x.k, y.k, subPatches, 0);
subPatches.length > 0 && _VirtualDom_pushPatch(patches, 1, index, subPatches);
return;
case 4:
// gather nested taggers
var xTaggers = x.j;
var yTaggers = y.j;
var nesting = false;
var xSubNode = x.k;
while (xSubNode.$ === 4)
{
nesting = true;
typeof xTaggers !== 'object'
? xTaggers = [xTaggers, xSubNode.j]
: xTaggers.push(xSubNode.j);
xSubNode = xSubNode.k;
}
var ySubNode = y.k;
while (ySubNode.$ === 4)
{
nesting = true;
typeof yTaggers !== 'object'
? yTaggers = [yTaggers, ySubNode.j]
: yTaggers.push(ySubNode.j);
ySubNode = ySubNode.k;
}
// Just bail if different numbers of taggers. This implies the
// structure of the virtual DOM has changed.
if (nesting && xTaggers.length !== yTaggers.length)
{
_VirtualDom_pushPatch(patches, 0, index, y);
return;
}
// check if taggers are "the same"
if (nesting ? !_VirtualDom_pairwiseRefEqual(xTaggers, yTaggers) : xTaggers !== yTaggers)
{
_VirtualDom_pushPatch(patches, 2, index, yTaggers);
}
// diff everything below the taggers
_VirtualDom_diffHelp(xSubNode, ySubNode, patches, index + 1);
return;
case 0:
if (x.a !== y.a)
{
_VirtualDom_pushPatch(patches, 3, index, y.a);
}
return;
case 1:
_VirtualDom_diffNodes(x, y, patches, index, _VirtualDom_diffKids);
return;
case 2:
_VirtualDom_diffNodes(x, y, patches, index, _VirtualDom_diffKeyedKids);
return;
case 3:
if (x.h !== y.h)
{
_VirtualDom_pushPatch(patches, 0, index, y);
return;
}
var factsDiff = _VirtualDom_diffFacts(x.d, y.d);
factsDiff && _VirtualDom_pushPatch(patches, 4, index, factsDiff);
var patch = y.i(x.g, y.g);
patch && _VirtualDom_pushPatch(patches, 5, index, patch);
return;
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_diffHelp
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_pairwiseRefEqual(as, bs)
{
for (var i = 0; i < as.length; i++)
{
if (as[i] !== bs[i])
{
return false;
}
}
return true;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_pairwiseRefEqual
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_diffNodes(x, y, patches, index, diffKids)
{
// Bail if obvious indicators have changed. Implies more serious
// structural changes such that it's not worth it to diff.
if (x.c !== y.c || x.f !== y.f)
{
_VirtualDom_pushPatch(patches, 0, index, y);
return;
}
var factsDiff = _VirtualDom_diffFacts(x.d, y.d);
factsDiff && _VirtualDom_pushPatch(patches, 4, index, factsDiff);
diffKids(x, y, patches, index);
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_diffNodes
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_diffFacts(x, y, category)
{
var diff;
// look for changes and removals
for (var xKey in x)
{
if (xKey === 'a1' || xKey === 'a0' || xKey === 'a3' || xKey === 'a4')
{
var subDiff = _VirtualDom_diffFacts(x[xKey], y[xKey] || {}, xKey);
if (subDiff)
{
diff = diff || {};
diff[xKey] = subDiff;
}
continue;
}
// remove if not in the new facts
if (!(xKey in y))
{
diff = diff || {};
diff[xKey] =
!category
? (typeof x[xKey] === 'string' ? '' : null)
:
(category === 'a1')
? ''
:
(category === 'a0' || category === 'a3')
? undefined
:
{ f: x[xKey].f, o: undefined };
continue;
}
var xValue = x[xKey];
var yValue = y[xKey];
// reference equal, so don't worry about it
if (xValue === yValue && xKey !== 'value' && xKey !== 'checked'
|| category === 'a0' && _VirtualDom_equalEvents(xValue, yValue))
{
continue;
}
diff = diff || {};
diff[xKey] = yValue;
}
// add new stuff
for (var yKey in y)
{
if (!(yKey in x))
{
diff = diff || {};
diff[yKey] = y[yKey];
}
}
return diff;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_diffFacts
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_diffKids(xParent, yParent, patches, index)
{
var xKids = xParent.e;
var yKids = yParent.e;
var xLen = xKids.length;
var yLen = yKids.length;
// FIGURE OUT IF THERE ARE INSERTS OR REMOVALS
if (xLen > yLen)
{
_VirtualDom_pushPatch(patches, 6, index, {
v: yLen,
i: xLen - yLen
});
}
else if (xLen < yLen)
{
_VirtualDom_pushPatch(patches, 7, index, {
v: xLen,
e: yKids
});
}
// PAIRWISE DIFF EVERYTHING ELSE
for (var minLen = xLen < yLen ? xLen : yLen, i = 0; i < minLen; i++)
{
var xKid = xKids[i];
_VirtualDom_diffHelp(xKid, yKids[i], patches, ++index);
index += xKid.b || 0;
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_diffKids
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_diffKeyedKids(xParent, yParent, patches, rootIndex)
{
var localPatches = [];
var changes = {}; // Dict String Entry
var inserts = []; // Array { index : Int, entry : Entry }
// type Entry = { tag : String, vnode : VNode, index : Int, data : _ }
var xKids = xParent.e;
var yKids = yParent.e;
var xLen = xKids.length;
var yLen = yKids.length;
var xIndex = 0;
var yIndex = 0;
var index = rootIndex;
while (xIndex < xLen && yIndex < yLen)
{
var x = xKids[xIndex];
var y = yKids[yIndex];
var xKey = x.a;
var yKey = y.a;
var xNode = x.b;
var yNode = y.b;
var newMatch = undefined;
var oldMatch = undefined;
// check if keys match
if (xKey === yKey)
{
index++;
_VirtualDom_diffHelp(xNode, yNode, localPatches, index);
index += xNode.b || 0;
xIndex++;
yIndex++;
continue;
}
// look ahead 1 to detect insertions and removals.
var xNext = xKids[xIndex + 1];
var yNext = yKids[yIndex + 1];
if (xNext)
{
var xNextKey = xNext.a;
var xNextNode = xNext.b;
oldMatch = yKey === xNextKey;
}
if (yNext)
{
var yNextKey = yNext.a;
var yNextNode = yNext.b;
newMatch = xKey === yNextKey;
}
// swap x and y
if (newMatch && oldMatch)
{
index++;
_VirtualDom_diffHelp(xNode, yNextNode, localPatches, index);
_VirtualDom_insertNode(changes, localPatches, xKey, yNode, yIndex, inserts);
index += xNode.b || 0;
index++;
_VirtualDom_removeNode(changes, localPatches, xKey, xNextNode, index);
index += xNextNode.b || 0;
xIndex += 2;
yIndex += 2;
continue;
}
// insert y
if (newMatch)
{
index++;
_VirtualDom_insertNode(changes, localPatches, yKey, yNode, yIndex, inserts);
_VirtualDom_diffHelp(xNode, yNextNode, localPatches, index);
index += xNode.b || 0;
xIndex += 1;
yIndex += 2;
continue;
}
// remove x
if (oldMatch)
{
index++;
_VirtualDom_removeNode(changes, localPatches, xKey, xNode, index);
index += xNode.b || 0;
index++;
_VirtualDom_diffHelp(xNextNode, yNode, localPatches, index);
index += xNextNode.b || 0;
xIndex += 2;
yIndex += 1;
continue;
}
// remove x, insert y
if (xNext && xNextKey === yNextKey)
{
index++;
_VirtualDom_removeNode(changes, localPatches, xKey, xNode, index);
_VirtualDom_insertNode(changes, localPatches, yKey, yNode, yIndex, inserts);
index += xNode.b || 0;
index++;
_VirtualDom_diffHelp(xNextNode, yNextNode, localPatches, index);
index += xNextNode.b || 0;
xIndex += 2;
yIndex += 2;
continue;
}
break;
}
// eat up any remaining nodes with removeNode and insertNode
while (xIndex < xLen)
{
index++;
var x = xKids[xIndex];
var xNode = x.b;
_VirtualDom_removeNode(changes, localPatches, x.a, xNode, index);
index += xNode.b || 0;
xIndex++;
}
while (yIndex < yLen)
{
var endInserts = endInserts || [];
var y = yKids[yIndex];
_VirtualDom_insertNode(changes, localPatches, y.a, y.b, undefined, endInserts);
yIndex++;
}
if (localPatches.length > 0 || inserts.length > 0 || endInserts)
{
_VirtualDom_pushPatch(patches, 8, rootIndex, {
w: localPatches,
x: inserts,
y: endInserts
});
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_diffKeyedKids
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_insertNode(changes, localPatches, key, vnode, yIndex, inserts)
{
var entry = changes[key];
// never seen this key before
if (!entry)
{
entry = {
c: 0,
z: vnode,
r: yIndex,
s: undefined
};
inserts.push({ r: yIndex, A: entry });
changes[key] = entry;
return;
}
// this key was removed earlier, a match!
if (entry.c === 1)
{
inserts.push({ r: yIndex, A: entry });
entry.c = 2;
var subPatches = [];
_VirtualDom_diffHelp(entry.z, vnode, subPatches, entry.r);
entry.r = yIndex;
entry.s.s = {
w: subPatches,
A: entry
};
return;
}
// this key has already been inserted or moved, a duplicate!
_VirtualDom_insertNode(changes, localPatches, key + _VirtualDom_POSTFIX, vnode, yIndex, inserts);
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_insertNode
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_removeNode(changes, localPatches, key, vnode, index)
{
var entry = changes[key];
// never seen this key before
if (!entry)
{
var patch = _VirtualDom_pushPatch(localPatches, 9, index, undefined);
changes[key] = {
c: 1,
z: vnode,
r: index,
s: patch
};
return;
}
// this key was inserted earlier, a match!
if (entry.c === 0)
{
entry.c = 2;
var subPatches = [];
_VirtualDom_diffHelp(vnode, entry.z, subPatches, index);
_VirtualDom_pushPatch(localPatches, 9, index, {
w: subPatches,
A: entry
});
return;
}
// this key has already been removed or moved, a duplicate!
_VirtualDom_removeNode(changes, localPatches, key + _VirtualDom_POSTFIX, vnode, index);
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_removeNode
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_addDomNodes(domNode, vNode, patches, eventNode)
{
_VirtualDom_addDomNodesHelp(domNode, vNode, patches, 0, 0, vNode.b, eventNode);
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_addDomNodes
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_addDomNodesHelp(domNode, vNode, patches, i, low, high, eventNode)
{
var patch = patches[i];
var index = patch.r;
while (index === low)
{
var patchType = patch.$;
if (patchType === 1)
{
_VirtualDom_addDomNodes(domNode, vNode.k, patch.s, eventNode);
}
else if (patchType === 8)
{
patch.t = domNode;
patch.u = eventNode;
var subPatches = patch.s.w;
if (subPatches.length > 0)
{
_VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
}
}
else if (patchType === 9)
{
patch.t = domNode;
patch.u = eventNode;
var data = patch.s;
if (data)
{
data.A.s = domNode;
var subPatches = data.w;
if (subPatches.length > 0)
{
_VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
}
}
}
else
{
patch.t = domNode;
patch.u = eventNode;
}
i++;
if (!(patch = patches[i]) || (index = patch.r) > high)
{
return i;
}
}
var tag = vNode.$;
if (tag === 4)
{
var subNode = vNode.k;
while (subNode.$ === 4)
{
subNode = subNode.k;
}
return _VirtualDom_addDomNodesHelp(domNode, subNode, patches, i, low + 1, high, domNode.elm_event_node_ref);
}
// tag must be 1 or 2 at this point
var vKids = vNode.e;
var childNodes = domNode.childNodes;
for (var j = 0; j < vKids.length; j++)
{
low++;
var vKid = tag === 1 ? vKids[j] : vKids[j].b;
var nextLow = low + (vKid.b || 0);
if (low <= index && index <= nextLow)
{
i = _VirtualDom_addDomNodesHelp(childNodes[j], vKid, patches, i, low, nextLow, eventNode);
if (!(patch = patches[i]) || (index = patch.r) > high)
{
return i;
}
}
low = nextLow;
}
return i;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_addDomNodesHelp
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyPatches(rootDomNode, oldVirtualNode, patches, eventNode)
{
if (patches.length === 0)
{
return rootDomNode;
}
_VirtualDom_addDomNodes(rootDomNode, oldVirtualNode, patches, eventNode);
return _VirtualDom_applyPatchesHelp(rootDomNode, patches);
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyPatches
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyPatchesHelp(rootDomNode, patches)
{
for (var i = 0; i < patches.length; i++)
{
var patch = patches[i];
var localDomNode = patch.t
var newNode = _VirtualDom_applyPatch(localDomNode, patch);
if (localDomNode === rootDomNode)
{
rootDomNode = newNode;
}
}
return rootDomNode;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyPatchesHelp
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyPatch(domNode, patch)
{
switch (patch.$)
{
case 0:
return _VirtualDom_applyPatchRedraw(domNode, patch.s, patch.u);
case 4:
_VirtualDom_applyFacts(domNode, patch.u, patch.s);
return domNode;
case 3:
domNode.replaceData(0, domNode.length, patch.s);
return domNode;
case 1:
return _VirtualDom_applyPatchesHelp(domNode, patch.s);
case 2:
if (domNode.elm_event_node_ref)
{
domNode.elm_event_node_ref.j = patch.s;
}
else
{
domNode.elm_event_node_ref = { j: patch.s, p: patch.u };
}
return domNode;
case 6:
var data = patch.s;
for (var i = 0; i < data.i; i++)
{
domNode.removeChild(domNode.childNodes[data.v]);
}
return domNode;
case 7:
var data = patch.s;
var kids = data.e;
var i = data.v;
var theEnd = domNode.childNodes[i];
for (; i < kids.length; i++)
{
domNode.insertBefore(_VirtualDom_render(kids[i], patch.u), theEnd);
}
return domNode;
case 9:
var data = patch.s;
if (!data)
{
domNode.parentNode.removeChild(domNode);
return domNode;
}
var entry = data.A;
if (typeof entry.r !== 'undefined')
{
domNode.parentNode.removeChild(domNode);
}
entry.s = _VirtualDom_applyPatchesHelp(domNode, data.w);
return domNode;
case 8:
return _VirtualDom_applyPatchReorder(domNode, patch);
case 5:
return patch.s(domNode);
default:
_Debug_crash(10); // 'Ran into an unknown patch!'
}
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyPatch
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyPatchRedraw(domNode, vNode, eventNode)
{
var parentNode = domNode.parentNode;
var newNode = _VirtualDom_render(vNode, eventNode);
if (!newNode.elm_event_node_ref)
{
newNode.elm_event_node_ref = domNode.elm_event_node_ref;
}
if (parentNode && newNode !== domNode)
{
parentNode.replaceChild(newNode, domNode);
}
return newNode;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyPatchRedraw
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyPatchReorder(domNode, patch)
{
var data = patch.s;
// remove end inserts
var frag = _VirtualDom_applyPatchReorderEndInsertsHelp(data.y, patch);
// removals
domNode = _VirtualDom_applyPatchesHelp(domNode, data.w);
// inserts
var inserts = data.x;
for (var i = 0; i < inserts.length; i++)
{
var insert = inserts[i];
var entry = insert.A;
var node = entry.c === 2
? entry.s
: _VirtualDom_render(entry.z, patch.u);
domNode.insertBefore(node, domNode.childNodes[insert.r]);
}
// add end inserts
if (frag)
{
_VirtualDom_appendChild(domNode, frag);
}
return domNode;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyPatchReorder
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_applyPatchReorderEndInsertsHelp(endInserts, patch)
{
if (!endInserts)
{
return;
}
var frag = _VirtualDom_doc.createDocumentFragment();
for (var i = 0; i < endInserts.length; i++)
{
var insert = endInserts[i];
var entry = insert.A;
_VirtualDom_appendChild(frag, entry.c === 2
? entry.s
: _VirtualDom_render(entry.z, patch.u)
);
}
return frag;
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_applyPatchReorderEndInsertsHelp
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_virtualize(node)
{
// TEXT NODES
if (node.nodeType === 3)
{
return _VirtualDom_text(node.textContent);
}
// WEIRD NODES
if (node.nodeType !== 1)
{
return _VirtualDom_text('');
}
// ELEMENT NODES
var attrList = _List_Nil;
var attrs = node.attributes;
for (var i = attrs.length; i--; )
{
var attr = attrs[i];
var name = attr.name;
var value = attr.value;
attrList = _List_Cons( A2(_VirtualDom_attribute, name, value), attrList );
}
var tag = node.tagName.toLowerCase();
var kidList = _List_Nil;
var kids = node.childNodes;
for (var i = kids.length; i--; )
{
kidList = _List_Cons(_VirtualDom_virtualize(kids[i]), kidList);
}
return A3(_VirtualDom_node, tag, attrList, kidList);
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_virtualize
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _VirtualDom_dekey(keyedNode)
{
var keyedKids = keyedNode.e;
var len = keyedKids.length;
var kids = new Array(len);
for (var i = 0; i < len; i++)
{
kids[i] = keyedKids[i].b;
}
return {
$: 1,
c: keyedNode.c,
d: keyedNode.d,
e: kids,
f: keyedNode.f,
b: keyedNode.b
};
}
|
/
var node = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_VirtualDom_dekey
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_makeAnimator(model, draw)
{
draw(model);
var state = 0;
function updateIfNeeded()
{
state = state === 1
? 0
: ( _Browser_requestAnimationFrame(updateIfNeeded), draw(model), 1 );
}
return function(nextModel, isSync)
{
model = nextModel;
isSync
? ( draw(model),
state === 2 && (state = 1)
)
: ( state === 0 && _Browser_requestAnimationFrame(updateIfNeeded),
state = 2
);
};
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_makeAnimator
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function updateIfNeeded()
{
state = state === 1
? 0
: ( _Browser_requestAnimationFrame(updateIfNeeded), draw(model), 1 );
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
updateIfNeeded
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_application(impl)
{
var onUrlChange = impl.onUrlChange;
var onUrlRequest = impl.onUrlRequest;
var key = function() { key.a(onUrlChange(_Browser_getUrl())); };
return _Browser_document({
setup: function(sendToApp)
{
key.a = sendToApp;
_Browser_window.addEventListener('popstate', key);
_Browser_window.navigator.userAgent.indexOf('Trident') < 0 || _Browser_window.addEventListener('hashchange', key);
return F2(function(domNode, event)
{
if (!event.ctrlKey && !event.metaKey && !event.shiftKey && event.button < 1 && !domNode.target && !domNode.hasAttribute('download'))
{
event.preventDefault();
var href = domNode.href;
var curr = _Browser_getUrl();
var next = $elm$url$Url$fromString(href).a;
sendToApp(onUrlRequest(
(next
&& curr.protocol === next.protocol
&& curr.host === next.host
&& curr.port_.a === next.port_.a
)
? $elm$browser$Browser$Internal(next)
: $elm$browser$Browser$External(href)
));
}
});
},
init: function(flags)
{
return A3(impl.init, flags, _Browser_getUrl(), key);
},
view: impl.view,
update: impl.update,
subscriptions: impl.subscriptions
});
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_application
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_getUrl()
{
return $elm$url$Url$fromString(_VirtualDom_doc.location.href).a || _Debug_crash(1);
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_getUrl
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_visibilityInfo()
{
return (typeof _VirtualDom_doc.hidden !== 'undefined')
? { hidden: 'hidden', change: 'visibilitychange' }
:
(typeof _VirtualDom_doc.mozHidden !== 'undefined')
? { hidden: 'mozHidden', change: 'mozvisibilitychange' }
:
(typeof _VirtualDom_doc.msHidden !== 'undefined')
? { hidden: 'msHidden', change: 'msvisibilitychange' }
:
(typeof _VirtualDom_doc.webkitHidden !== 'undefined')
? { hidden: 'webkitHidden', change: 'webkitvisibilitychange' }
: { hidden: 'hidden', change: 'visibilitychange' };
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_visibilityInfo
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_rAF()
{
return _Scheduler_binding(function(callback)
{
var id = _Browser_requestAnimationFrame(function() {
callback(_Scheduler_succeed(Date.now()));
});
return function() {
_Browser_cancelAnimationFrame(id);
};
});
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_rAF
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_now()
{
return _Scheduler_binding(function(callback)
{
callback(_Scheduler_succeed(Date.now()));
});
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_now
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_withNode(id, doStuff)
{
return _Scheduler_binding(function(callback)
{
_Browser_requestAnimationFrame(function() {
var node = document.getElementById(id);
callback(node
? _Scheduler_succeed(doStuff(node))
: _Scheduler_fail($elm$browser$Browser$Dom$NotFound(id))
);
});
});
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_withNode
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_withWindow(doStuff)
{
return _Scheduler_binding(function(callback)
{
_Browser_requestAnimationFrame(function() {
callback(_Scheduler_succeed(doStuff()));
});
});
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_withWindow
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_getViewport()
{
return {
scene: _Browser_getScene(),
viewport: {
x: _Browser_window.pageXOffset,
y: _Browser_window.pageYOffset,
width: _Browser_doc.documentElement.clientWidth,
height: _Browser_doc.documentElement.clientHeight
}
};
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_getViewport
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_getScene()
{
var body = _Browser_doc.body;
var elem = _Browser_doc.documentElement;
return {
width: Math.max(body.scrollWidth, body.offsetWidth, elem.scrollWidth, elem.offsetWidth, elem.clientWidth),
height: Math.max(body.scrollHeight, body.offsetHeight, elem.scrollHeight, elem.offsetHeight, elem.clientHeight)
};
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_getScene
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_getViewportOf(id)
{
return _Browser_withNode(id, function(node)
{
return {
scene: {
width: node.scrollWidth,
height: node.scrollHeight
},
viewport: {
x: node.scrollLeft,
y: node.scrollTop,
width: node.clientWidth,
height: node.clientHeight
}
};
});
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_getViewportOf
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_getElement(id)
{
return _Browser_withNode(id, function(node)
{
var rect = node.getBoundingClientRect();
var x = _Browser_window.pageXOffset;
var y = _Browser_window.pageYOffset;
return {
scene: _Browser_getScene(),
viewport: {
x: x,
y: y,
width: _Browser_doc.documentElement.clientWidth,
height: _Browser_doc.documentElement.clientHeight
},
element: {
x: x + rect.left,
y: y + rect.top,
width: rect.width,
height: rect.height
}
};
});
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_getElement
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_reload(skipCache)
{
return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function(callback)
{
_VirtualDom_doc.location.reload(skipCache);
}));
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_reload
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
function _Browser_load(url)
{
return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function(callback)
{
try
{
_Browser_window.location = url;
}
catch(err)
{
// Only Firefox can throw a NS_ERROR_MALFORMED_URI exception here.
// Other browsers reload the page, so let's be consistent about that.
_VirtualDom_doc.location.reload(false);
}
}));
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
_Browser_load
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
$elm$core$Dict$toList = function (dict) {
return A3(
$elm$core$Dict$foldr,
F3(
function (key, value, list) {
return A2(
$elm$core$List$cons,
_Utils_Tuple2(key, value),
list);
}),
_List_Nil,
dict);
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
$elm$core$Dict$toList
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
$elm$core$Dict$keys = function (dict) {
return A3(
$elm$core$Dict$foldr,
F3(
function (key, value, keyList) {
return A2($elm$core$List$cons, key, keyList);
}),
_List_Nil,
dict);
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
$elm$core$Dict$keys
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
$elm$core$Set$toList = function (_v0) {
var dict = _v0.a;
return $elm$core$Dict$keys(dict);
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
$elm$core$Set$toList
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
$elm$core$Array$toList = function (array) {
return A3($elm$core$Array$foldr, $elm$core$List$cons, _List_Nil, array);
}
|
/
var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
//
|
$elm$core$Array$toList
|
javascript
|
Boscop/web-view
|
webview-examples/examples/todo-elm/elm.js
|
https://github.com/Boscop/web-view/blob/master/webview-examples/examples/todo-elm/elm.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.