Михаил Капелько 11 months ago
parent
commit
e79ea66ad4
5 changed files with 15 additions and 17 deletions
  1. +2
    -8
      shared/javaScript.js
  2. +3
    -7
      shared/typeScript.ts
  3. +1
    -0
      web/memory.html
  4. +6
    -0
      web/platform.js
  5. +3
    -2
      будущее

+ 2
- 8
shared/javaScript.js View File

@@ -1,10 +1,3 @@
var Position = /** @class */ (function () {
function Position(x, y) {
this.x = x;
this.y = y;
}
return Position;
}());
function memoryGap() {
return memorySide() + memorySpace();
}
@@ -20,7 +13,8 @@ function memoryItemPositions(c) {
var row = Math.floor(i / 4);
var x = memoryGap() + (i - row * 4) * memoryGap();
var y = memoryGap() + row * memoryGap();
pos.push(new Position(x, y));
// @ts-ignore
pos.push(memoryCreatePosition(x, y));
}
return pos;
}

+ 3
- 7
shared/typeScript.ts View File

@@ -2,14 +2,9 @@ interface Context {
itemsCount: number
}

class Position {
interface Position {
x: number
y: number
constructor(x, y) {
this.x = x
this.y = y
}
}

function memoryGap(): number {
@@ -30,7 +25,8 @@ function memoryItemPositions(c: Context): Position[] {
let row = Math.floor(i / 4)
let x = memoryGap() + (i - row * 4) * memoryGap()
let y = memoryGap() + row * memoryGap()
pos.push(new Position(x, y))
// @ts-ignore
pos.push(memoryCreatePosition(x, y))
}
return pos
}

+ 1
- 0
web/memory.html View File

@@ -6,6 +6,7 @@
<body>
</body>
<script src="../shared/javaScript.js"></script>
<script src="platform.js"></script>
<script>
var items = []



+ 6
- 0
web/platform.js View File

@@ -0,0 +1,6 @@
function memoryCreatePosition(x, y) {
return {
"x": x,
"y": y,
};
}

+ 3
- 2
будущее View File

@@ -2,10 +2,11 @@

* перейти на один файл ts
* перейти на один файл js
* оставить в файле ts лишь interfaces
* ввести внешние функции создания экземпляров интерфейсов в js
* web/platform.js

НАДО:
* оставить в файле ts лишь interfaces
* ввести внешние функции создания экземпляров интерфейсов
* перейти на один файл swift
* генерить по одному файлу в shared
* в проектах ссылаться по одному файлу


Loading…
Cancel
Save