update environment

master
xieguigang 7 years ago
parent 51245cf51d
commit 3853fdad52

@ -907,6 +907,27 @@ var IEnumerator = /** @class */ (function (_super) {
IEnumerator.prototype.OrderByDescending = function (key) {
return Enumerable.OrderByDescending(this.sequence, key);
};
/**
* Split a sequence by elements count
*/
IEnumerator.prototype.Split = function (size) {
var seq = [];
var row = [];
for (var _i = 0, _a = this.sequence; _i < _a.length; _i++) {
var element = _a[_i];
if (row.length < size) {
row.push(element);
}
else {
seq.push(row);
row = [];
}
}
if (row.length > 0) {
seq.push(row);
}
return new IEnumerator(seq);
};
/**
* 取出序列之中的前n个元素
*/
@ -924,7 +945,8 @@ var IEnumerator = /** @class */ (function (_super) {
*/
IEnumerator.prototype.Reverse = function () {
var rseq = this.ToArray().reverse();
return new IEnumerator(rseq);
var seq = new IEnumerator(rseq);
return seq;
};
/**
* Returns elements from a sequence as long as a specified condition is true.
@ -5935,16 +5957,16 @@ var TypeScript;
garbageCollect.handler = getHandler();
function getHandler() {
if (typeof window.require === "function") {
var require = window.require;
var require_1 = window.require;
try {
require("v8").setFlagsFromString('--expose_gc');
require_1("v8").setFlagsFromString('--expose_gc');
if (window.global != null) {
var global = window.global;
if (typeof global.gc == "function") {
return global.gc;
var global_1 = window.global;
if (typeof global_1.gc == "function") {
return global_1.gc;
}
}
var vm = require("vm");
var vm = require_1("vm");
if (vm != null) {
if (typeof vm.runInNewContext == "function") {
var k = vm.runInNewContext("gc");
@ -5979,9 +6001,9 @@ var TypeScript;
// }
//}
if (typeof window.global !== 'undefined') {
var global = window.global;
if (global.gc) {
return global.gc;
var global_2 = window.global;
if (global_2.gc) {
return global_2.gc;
}
}
//if (typeof Duktape == 'object') {

@ -17,12 +17,13 @@ enum nodeStatus {
}
enum protocols {
return_initialize_data
return_initialize_data,
log_events
}
interface message {
protocol: protocols;
msg: GridNode[]
msg: GridNode[] | string;
}
module app {
@ -52,16 +53,31 @@ module app {
switch (msg.protocol) {
case protocols.return_initialize_data:
drawInterface(msg.msg);
drawInterface(<GridNode[]>msg.msg);
break;
case protocols.log_events:
logEvents(<string>msg.msg);
default:
throw `not implements: ${msg.protocol}`;
}
}
function logEvents(event: string) {
}
function drawInterface(data: GridNode[]) {
// 5个节点一行
let matrix = $ts("#grid");
let matrix: HTMLBodyElement = <any>$ts("#grid");
let columns: number = 5;
let mat: IEnumerator<GridNode[]> = $ts(data).Split(columns);
for (let mrow of mat.ToArray(false)) {
let row = $ts("<tr>");
// row
matrix.appendChild(row);
}
}
}

@ -293,6 +293,10 @@ declare class IEnumerator<T> extends LINQIterator<T> {
* sorted in descending order according to a key.
*/
OrderByDescending(key: (e: T) => number): IEnumerator<T>;
/**
* Split a sequence by elements count
*/
Split(size: number): IEnumerator<T[]>;
/**
* n
*/

@ -1 +1 @@
Subproject commit e95d2ae72dc58ce7c5e22ab16c0a7cb97f282dea
Subproject commit be6109bf643c799771be8e9caccbe212a70f94af
Loading…
Cancel
Save