8:00 – 4:30 SR
- Everything’s working on site
- Rippled the ATSBase changes through the Charts codebase. Everything works.
- Wrote up my notes here.
8:00 – 4:30 SR
8:00 – 5:00 SR
8:00 – 5:00 SR
export class ATSBase {
constructor() {
/****/
this["timeoutFunction"] = () => {
var proto:Object = this["__proto__"];
proto["timeoutFunction"].apply(this, arguments);
};
this["myFunction"] = () => {
var proto:Object = this["__proto__"];
proto["myFunction"].apply(this, arguments);
};
console.log("done");
/****/
}
}
class Base {
constructor() {
for (var p in this)
if (!Object.prototype.hasOwnProperty.call(this, p) && typeof this[p] == 'function') {
var method = this[p];
this[p] = () => { method.apply(this, arguments); };
// (make a prototype method bound to the instance)
}
}
}
8:00 – 4:30 SR
8:00 – 3:00 SR
export class FatSuperBase {
public functionMap:any[];
constructor() {
this.functionMap = [];
}
public setFatPrototype(fn:Function, n:string){
// TODO: look for earlier prototypes that we might need to call
if(!this.functionMap.hasOwnProperty(n)){
this.functionMap[n] = [];
}
this.functionMap[n].push(fn);
}
public fatSuper(fnName:string, childArgs:IArguments){
// TODO: look for earlier prototypes that we might need to call
var fn:Function;
var farray:Function[];
if(this.functionMap.hasOwnProperty(fnName)){
farray = this.functionMap[fnName];
fn = farray[farray.length-1];
fn.apply(fn, childArgs);
}else{
console.log("fatSuper(): function '"+fnName+"'does not exist on the prototype chain");
}
}
}
7:00 – 3:30 SR
export class TestController implements ITestController {
// standard TypeScript constructor
constructor() {
}
public extendableFunction():void{
alert("It's extendableFunction()");
}
public fatArrowFunction = ():void => {
alert("It's fatArrowFunction()");
}
}
var TestController = (function () {
// standard TypeScript constructor
function TestController() {
var _this = this;
this.fatArrowFunction = function () {
alert("It's fatArrowFunction()");
};
}
TestController.prototype.extendableFunction = function () {
alert("It's extendableFunction()");
};
return TestController;
})();
InheritApp.TestController = TestController;
export class TestController2 extends TestController implements ITestController2 {
myInheritedString:string;
// standard inheriting constructor pattern. Note that 'super' must be on the first line and
// that the arguments from angular get passed through
constructor(){
super();
}
public extendableFunction():void{
super.extendableFunction();
}
}
var TestController2 = (function (_super) {
__extends(TestController2, _super);
function TestController2() {
_super.call(this);
}
TestController2.prototype.extendableFunction = function () {
_super.prototype.extendableFunction.call(this);
};
return TestController2;
})(TestController);
InheritApp.TestController2 = TestController2;
var TestController2 = (function (_super) {
__extends(TestController2, _super);
function TestController2() {
_super.apply(this, arguments);
}
return TestController2;
})(TestController);
InheritApp.TestController2 = TestController2;
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
this[fatArrowFunction] = function () {
alert("It's fatArrowFunction()");
}
export class TestController implements ITestController {
public functionMap:Function[];
// standard TypeScript constructor
constructor() {
this.functionMap = [];
this.setFatPrototype(this.fatArrowFunction, "fatArrowFunction");
}
public fatArrowFunction = (arg:string):void => {
alert("It's fatArrowFunction("+arg+")");
};
public extendableFunction():void{
alert("It's extendableFunction()");
}
public setFatPrototype(fn:Function, n:string){
// TODO: look for earlier prototypes that we might need to call
fn["name"] = n;
this.functionMap[n] = fn;
}
public fatSuper(fnName:string, childArgs:IArguments){
// TODO: look for earlier prototypes that we might need to call
var fn;Function;
if(this.functionMap.hasOwnProperty(fnName)){
fn = this.functionMap[fnName];
fn.apply(fn, childArgs);
}else{
console.log("fatSuper(): function '"+fnName+"'does not exist on the prototype chain");
}
}
}
export class TestController2 extends TestController implements ITestController2 {
public extendableFunction():void{
super.extendableFunction();
}
public fatArrowFunction = (arg:string):void => {
this.fatSuper("fatArrowFunction", arguments);
alert("It's fatArrowFunction2("+arg+")");
};
}
8:00 – 4:00 SR
public behavior = (dClock:number, elapsed:number):void => {
var rb = this.wglCanvas;
var ci:IChartElement;
var i:number = 0;
if (rb) {
rb.dprint("Hello controller - sin(elapsed) = " + Math.sin(elapsed).toFixed(2));
for (i = 0; i < this.chartElements.length; i++) {
ci = this.chartElements[i];
ci.setZOffset(Math.sin(elapsed + i));
ci.behavior(dClock, elapsed);
}
}
};
You must be logged in to post a comment.