Skip to content

Commit 7ad4774

Browse files
author
Mihail Slavchev
committed
make ts_helper.js part of the project template
1 parent b15f810 commit 7ad4774

2 files changed

Lines changed: 106 additions & 7 deletions

File tree

build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,6 @@ task copyGradleTemplate (type: Copy) {
147147
into "$rootDir/dist/framework"
148148
}
149149

150-
task copyInternalFolder (type: Copy) {
151-
from "$rootDir/src/assets/internal"
152-
into "$rootDir/dist/framework/src/main/assets/internal"
153-
}
154-
155150
task copyPackageJson (type: Copy) {
156151
from "$rootDir/package.json"
157152
into "$rootDir/dist"
@@ -270,8 +265,7 @@ createDistDir.dependsOn(cleanDistDir)
270265
//copy framework structure
271266
// cloneSBgeneratorInTemplate.dependsOn(copyLatestWidgetsJar)
272267
copyGradleTemplate.dependsOn(createDistDir)
273-
copyInternalFolder.dependsOn(copyGradleTemplate)
274-
fixVersion.dependsOn(copyInternalFolder)
268+
fixVersion.dependsOn(copyGradleTemplate)
275269
copyPackageJson.dependsOn(fixVersion)
276270
revertPackageJson.dependsOn(copyPackageJson)
277271

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
(function() {
2+
var __extends_ts = function (d, b) {
3+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
4+
function __() { this.constructor = d; }
5+
__.prototype = b.prototype;
6+
d.prototype = new __();
7+
};
8+
9+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
11+
switch (arguments.length) {
12+
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
13+
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
14+
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
15+
}
16+
};
17+
18+
var __native = function(thiz) {
19+
var result = thiz.__proto__;
20+
21+
for (var prop in thiz)
22+
{
23+
if (thiz.hasOwnProperty(prop))
24+
{
25+
thiz.__proto__[prop] = thiz[prop];
26+
delete thiz[prop];
27+
}
28+
}
29+
30+
thiz.constructor = undefined;
31+
thiz.__proto__ = undefined;
32+
Object.freeze(thiz);
33+
Object.preventExtensions(thiz)
34+
return result;
35+
};
36+
37+
var __extends = function(Child, Parent) {
38+
39+
if (Parent.extend) {
40+
if (Parent.__isPrototypeImplementationObject) {
41+
throw new Error("Can not extend an already extended native object.");
42+
}
43+
44+
function extend(child, parent) {
45+
__log("TS extend called");
46+
if (!child.__extended) {
47+
child.__extended = parent.extend(child.name, child.prototype);
48+
}
49+
50+
return child.__extended;
51+
};
52+
53+
Parent.__activityExtend = function(parent, name, implementationObject) {
54+
__log("__activityExtend called");
55+
return parent.extend(name, implementationObject);
56+
};
57+
58+
Parent.call = function(thiz) {
59+
var Extended = extend(thiz.__proto__.__child, thiz.__proto__.__parent);
60+
if (arguments.length > 1)
61+
{
62+
thiz.__proto__ = new (Function.prototype.bind.apply(Extended, [null].concat(Array.prototype.slice.call(arguments, 1))));
63+
}
64+
else
65+
{
66+
thiz.__proto__ = new Extended();
67+
}
68+
};
69+
70+
Parent.apply = function(thiz, args) {
71+
var Extended = extend(thiz.__proto__.__child, thiz.__proto__.__parent);
72+
if (args && args.length > 0)
73+
{
74+
thiz.__proto__ = new (Function.prototype.bind.apply(Extended, [null].concat(args)));
75+
}
76+
else
77+
{
78+
thiz.__proto__ = new Extended();
79+
}
80+
};
81+
}
82+
83+
__extends_ts(Child, Parent);
84+
85+
if (Parent.extend) {
86+
Child.__isPrototypeImplementationObject = true;
87+
Child.__proto__ = Parent;
88+
Child.prototype.__parent = Parent;
89+
Child.prototype.__child = Child;
90+
}
91+
}
92+
93+
function JavaProxy(className) {
94+
return function (target) {
95+
var extended = target.extend(className, target.prototype)
96+
extended.name = className;
97+
return extended;
98+
};
99+
}
100+
101+
global.__native = __native;
102+
global.__extends = __extends;
103+
global.__decorate = __decorate;
104+
global.JavaProxy = JavaProxy;
105+
})()

0 commit comments

Comments
 (0)