Skip to content
This repository was archived by the owner on Dec 9, 2021. It is now read-only.

Commit fc216ee

Browse files
author
rsavian
committed
Add *.d.ts files and update TypeScript compiler version. v0.15.0
1 parent 93fef9e commit fc216ee

File tree

94 files changed

+6915
-1316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+6915
-1316
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ module.exports = function(grunt) {
147147
module: 'umd',
148148
basePath: '',
149149
sourceMap: false,
150-
declaration: false,
150+
declaration: true,
151151
nolib: false,
152152
comments: true
153153
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ _onClickHandler(event) {
252252

253253
## Release History
254254

255+
* 2016-13-15 v0.15.0 Add *.d.ts files and update TypeScript compiler version.
256+
255257
* 2016-13-15 v0.14.9 Fix TypeScript file issues.
256258

257259
* 2016-13-15 v0.14.8 Util - Fix issue with deletePropertyFromObject.

bower.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "structurejs",
3-
"version": "0.14.9",
3+
"version": "0.15.0",
44
"dependencies": {
55
"jquery": "*",
66
"handlebars": "*"
@@ -16,6 +16,9 @@
1616
"license": "MIT",
1717
"homepage": "https://github.com/codeBelt/StructureJS",
1818
"ignore": [
19+
".idea",
20+
"coverage",
21+
"old-test",
1922
"node_modules",
2023
"index.js",
2124
"__tests__",

js/BaseObject.d.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* The {{#crossLink "BaseObject"}}{{/crossLink}} class is an abstract class that provides common properties and functionality for all StructureJS classes.
3+
*
4+
* @class BaseObject
5+
* @module StructureJS
6+
* @submodule core
7+
* @requires Util
8+
* @constructor
9+
* @author Robert S. (www.codeBelt.com)
10+
*/
11+
declare class BaseObject {
12+
/**
13+
* The sjsId (StructureJS ID) is a unique identifier automatically assigned to most StructureJS objects upon instantiation.
14+
*
15+
* @property sjsId
16+
* @type {int}
17+
* @default null
18+
* @writeOnce
19+
* @readOnly
20+
* @public
21+
*/
22+
sjsId: number;
23+
constructor();
24+
/**
25+
* Returns the fully qualified class name of an object.
26+
*
27+
* @method getQualifiedClassName
28+
* @returns {string} Returns the class name.
29+
* @public
30+
* @example
31+
* let someClass = new SomeClass();
32+
* someClass.getQualifiedClassName();
33+
*
34+
* // SomeClass
35+
*/
36+
getQualifiedClassName(): string;
37+
/**
38+
* The purpose of the destroy method is to make an object ready for garbage collection. This
39+
* should be thought of as a one way function. Once destroy is called no further methods should be
40+
* called on the object or properties accessed. It is the responsibility of those who implement this
41+
* function to stop all running Timers, all running Sounds, and take any other steps necessary to make an
42+
* object eligible for garbage collection.
43+
*
44+
* By default the destroy method will null out all properties of the class automatically. You should call destroy
45+
* on other objects before calling the super.
46+
*
47+
* @method destroy
48+
* @return {void}
49+
* @public
50+
* @example
51+
* destroy() {
52+
* this.disable();
53+
*
54+
* this._childInstance.destroy();
55+
*
56+
* super.destroy();
57+
* }
58+
*/
59+
destroy(): void;
60+
}
61+
export default BaseObject;

js/BaseObject.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
(function (factory) {
2-
if (typeof module === 'object' && typeof module.exports === 'object') {
3-
var v = factory(require, exports); if (v !== undefined) module.exports = v;
2+
if (typeof module === "object" && typeof module.exports === "object") {
3+
var v = factory(require, exports);
4+
if (v !== undefined) module.exports = v;
45
}
5-
else if (typeof define === 'function' && define.amd) {
6-
define(["require", "exports", './util/Util'], factory);
6+
else if (typeof define === "function" && define.amd) {
7+
define(["require", "exports", "./util/Util"], factory);
78
}
89
})(function (require, exports) {
910
"use strict";
10-
var Util_1 = require('./util/Util');
11+
var Util_1 = require("./util/Util");
1112
/**
1213
* The {{#crossLink "BaseObject"}}{{/crossLink}} class is an abstract class that provides common properties and functionality for all StructureJS classes.
1314
*

js/ObjectManager.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import BaseObject from './BaseObject';
2+
/**
3+
* The {{#crossLink "ObjectManager"}}{{/crossLink}} class is an abstract class that provides enabling and disabling functionality for most StructureJS classes.
4+
*
5+
* @class ObjectManager
6+
* @module StructureJS
7+
* @extends BaseObject
8+
* @submodule core
9+
* @requires Extend
10+
* @requires BaseObject
11+
* @constructor
12+
* @author Robert S. (www.codeBelt.com)
13+
*/
14+
declare class ObjectManager extends BaseObject {
15+
/**
16+
* The isEnabled property is used to keep track of the enabled state of the object.
17+
*
18+
* @property isEnabled
19+
* @type {boolean}
20+
* @default false
21+
* @public
22+
*/
23+
isEnabled: boolean;
24+
constructor();
25+
/**
26+
* The enable method is responsible for enabling event listeners and/or children of the containing objects.
27+
*
28+
* @method enable
29+
* @public
30+
* @chainable
31+
* @example
32+
* enable() {
33+
* if (this.isEnabled === true) { return; }
34+
*
35+
* this._childInstance.addEventListener(BaseEvent.CHANGE, this.handlerMethod, this);
36+
* this._childInstance.enable();
37+
*
38+
* super.enable();
39+
* }
40+
*/
41+
enable(): any;
42+
/**
43+
* The disable method is responsible for disabling event listeners and/or children of the containing objects.
44+
*
45+
* @method disable
46+
* @public
47+
* @chainable
48+
* @example
49+
* disable() {
50+
* if (this.isEnabled === false) { return; }
51+
*
52+
* this._childInstance.removeEventListener(BaseEvent.CHANGE, this.handlerMethod, this);
53+
* this._childInstance.disable();
54+
*
55+
* super.disable();
56+
* }
57+
*/
58+
disable(): any;
59+
}
60+
export default ObjectManager;

js/ObjectManager.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ var __extends = (this && this.__extends) || function (d, b) {
44
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
55
};
66
(function (factory) {
7-
if (typeof module === 'object' && typeof module.exports === 'object') {
8-
var v = factory(require, exports); if (v !== undefined) module.exports = v;
7+
if (typeof module === "object" && typeof module.exports === "object") {
8+
var v = factory(require, exports);
9+
if (v !== undefined) module.exports = v;
910
}
10-
else if (typeof define === 'function' && define.amd) {
11-
define(["require", "exports", './BaseObject'], factory);
11+
else if (typeof define === "function" && define.amd) {
12+
define(["require", "exports", "./BaseObject"], factory);
1213
}
1314
})(function (require, exports) {
1415
"use strict";
15-
var BaseObject_1 = require('./BaseObject');
16+
var BaseObject_1 = require("./BaseObject");
1617
/**
1718
* The {{#crossLink "ObjectManager"}}{{/crossLink}} class is an abstract class that provides enabling and disabling functionality for most StructureJS classes.
1819
*
@@ -28,7 +29,7 @@ var __extends = (this && this.__extends) || function (d, b) {
2829
var ObjectManager = (function (_super) {
2930
__extends(ObjectManager, _super);
3031
function ObjectManager() {
31-
_super.call(this);
32+
var _this = _super.call(this) || this;
3233
/**
3334
* The isEnabled property is used to keep track of the enabled state of the object.
3435
*
@@ -37,7 +38,8 @@ var __extends = (this && this.__extends) || function (d, b) {
3738
* @default false
3839
* @public
3940
*/
40-
this.isEnabled = false;
41+
_this.isEnabled = false;
42+
return _this;
4143
}
4244
/**
4345
* The enable method is responsible for enabling event listeners and/or children of the containing objects.

js/display/Bitmap.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import DisplayObject from './DisplayObject';
2+
declare class Bitmap extends DisplayObject {
3+
protected _image: HTMLImageElement;
4+
ready: boolean;
5+
constructor(image: HTMLImageElement);
6+
create(): void;
7+
layout(): void;
8+
}
9+
export default Bitmap;

js/display/Bitmap.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@ var __extends = (this && this.__extends) || function (d, b) {
44
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
55
};
66
(function (factory) {
7-
if (typeof module === 'object' && typeof module.exports === 'object') {
8-
var v = factory(require, exports); if (v !== undefined) module.exports = v;
7+
if (typeof module === "object" && typeof module.exports === "object") {
8+
var v = factory(require, exports);
9+
if (v !== undefined) module.exports = v;
910
}
10-
else if (typeof define === 'function' && define.amd) {
11-
define(["require", "exports", './DisplayObject', '../util/MathUtil'], factory);
11+
else if (typeof define === "function" && define.amd) {
12+
define(["require", "exports", "./DisplayObject", "../util/MathUtil"], factory);
1213
}
1314
})(function (require, exports) {
1415
"use strict";
15-
var DisplayObject_1 = require('./DisplayObject');
16-
var MathUtil_1 = require('../util/MathUtil');
16+
var DisplayObject_1 = require("./DisplayObject");
17+
var MathUtil_1 = require("../util/MathUtil");
1718
var Bitmap = (function (_super) {
1819
__extends(Bitmap, _super);
1920
function Bitmap(image) {
20-
_super.call(this);
21-
this.ready = false;
22-
this._image = image;
23-
this.width = this._image.width;
24-
this.height = this._image.height;
25-
this.setSize(this.width, this.height);
21+
var _this = _super.call(this) || this;
22+
_this.ready = false;
23+
_this._image = image;
24+
_this.width = _this._image.width;
25+
_this.height = _this._image.height;
26+
_this.setSize(_this.width, _this.height);
27+
return _this;
2628
}
2729
Bitmap.prototype.create = function () {
2830
_super.prototype.create.call(this);

js/display/CanvasElement.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,28 @@ var __extends = (this && this.__extends) || function (d, b) {
44
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
55
};
66
(function (factory) {
7-
if (typeof module === 'object' && typeof module.exports === 'object') {
8-
var v = factory(require, exports); if (v !== undefined) module.exports = v;
7+
if (typeof module === "object" && typeof module.exports === "object") {
8+
var v = factory(require, exports);
9+
if (v !== undefined) module.exports = v;
910
}
10-
else if (typeof define === 'function' && define.amd) {
11-
define(["require", "exports", './DisplayObjectContainer', './DOMElement', '../geom/Point'], factory);
11+
else if (typeof define === "function" && define.amd) {
12+
define(["require", "exports", "./DisplayObjectContainer", "./DOMElement", "../geom/Point"], factory);
1213
}
1314
})(function (require, exports) {
1415
"use strict";
15-
var DisplayObjectContainer_1 = require('./DisplayObjectContainer');
16-
var DOMElement_1 = require('./DOMElement');
17-
var Point_1 = require('../geom/Point');
16+
var DisplayObjectContainer_1 = require("./DisplayObjectContainer");
17+
var DOMElement_1 = require("./DOMElement");
18+
var Point_1 = require("../geom/Point");
1819
var CanvasElement = (function (_super) {
1920
__extends(CanvasElement, _super);
2021
// Notice the capital W and H. That sets the attributes not the styles.
2122
function CanvasElement(type, params) {
2223
if (type === void 0) { type = 'canvas'; }
2324
if (params === void 0) { params = { Width: 100, Height: 100 }; }
24-
_super.call(this, type, params);
25-
this.$canvas = null;
26-
this.canvas = null;
25+
var _this = _super.call(this, type, params) || this;
26+
_this.$canvas = null;
27+
_this.canvas = null;
28+
return _this;
2729
}
2830
/**
2931
* @overridden CanvasElement.create

0 commit comments

Comments
 (0)