Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions IndexedDB/IndexedQueryCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ const IndexedQueryCompiler = {
*
* @return {undefined}
*/
_make(storeName, db) {
this._allQueries = [];
this._store = storeName;
this._db = db;
new(storeName, db) {
const _allQueries = [];
const _store = storeName;
const _db = db;

return { _allQueries, _store, _db, __proto__: this };
},

/**
Expand Down
36 changes: 16 additions & 20 deletions IndexedDB/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const IndexedStoreDefinition = {
name: '',
indexes: null,

_make(info) {
this.description = info;
this.indexes = [];
new(info) {
const description = info;
const indexes = [];

return { description, indexes, __proto__: this };
}
};

Expand Down Expand Up @@ -38,11 +40,13 @@ const IndexedDefinition = {
*
* @param {number} version
*
* @return {undefined}
* @return {IndexedDefinition}
*/
_make(version) {
this._version = version;
this._allStores = [];
new(version) {
const _version = version;
const _allStores = [];

return { _version, _allStores, __proto__: this };
},

/**
Expand Down Expand Up @@ -177,20 +181,12 @@ const IndexedDB = {
*
* @param {string} name of the db to open
*/
constructor(name) {
this._name = name;
this._definitions = [];

this._promise = async(this._setup.bind(this));
new(name) {
const _name = name;
const _definitions = [];
const _promise = async(this._setup.bind(this));

return this;
},

/**
* @deprecated
*/
_make(...args) {
return this.constructor(...args);
return { _name, _definitions, _promise, __proto__: this };
},

/**
Expand Down
18 changes: 2 additions & 16 deletions core/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,8 @@ const Application = {
*
* @return {Application}
*/
constructor() {
super.constructor();

return this;
},

/**
* @deprecated Do not use any more.
* @see Application.constructor
*
* @param {any[]} args {@link Application.constructor}
*
* @return {Application} the current instance
*/
_make(...args) {
return this.constructor(...args);
new() {
return { __proto__: this };
},

/**
Expand Down
14 changes: 7 additions & 7 deletions core/DataStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ const DataStorage = {
/**
* @return {DataStorage}
*/
constructor() {
super.constructor();
new() {
const instance = super.new();

this.when = whenFilled(this);
this.whenNext = whenNext(this);
this.once = once(this);
this._filledCallbacks = [];
instance.when = whenFilled(instance);
instance.whenNext = whenNext(instance);
instance.once = once(instance);
instance._filledCallbacks = [];

return this;
return instance;
},

/**
Expand Down
15 changes: 3 additions & 12 deletions core/EventTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,10 @@ const EventTarget = {
/**
* @return {EventTarget}
*/
constructor() {
this._listeners = {};
new() {
const _listeners = {};

return this;
},

/**
* @deprecated Do not use the make constructors
*
* @return {this} [description]
*/
_make(...args) {
return this.constructor(...args);
return { _listeners, __proto__: this };
},

/**
Expand Down
6 changes: 3 additions & 3 deletions core/InjectionReceiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const InjectionReceiver = {
/**
* @return {InjectionReceiver}
*/
constructor() {
this._injectedObjects = new WeakMap();
new() {
const _injectedObjects = new WeakMap();

return this;
return { _injectedObjects, __proto__: this };
},

/**
Expand Down
22 changes: 4 additions & 18 deletions core/NetworkRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,11 @@ const NetworkRequest = {
*
* @return {NetworkRequest} the request it self
*/
constructor(url, { method = 'GET', type = 'none' } = {}) {
this.type = type;
this.method = method;
this._headers = {};
this.url = url;
this._listeners = [];
new(url, { method = 'GET', type = 'none' } = {}) {
const _headers = {};
const _listeners = [];

return this;
},

/**
* [_make description]
*
* @deprecated use the constructor
* @param {array} args [description]
* @return {void} [description]
*/
_make(...args) {
return this.constructor(...args);
return { method, type, _headers, _listeners, __proto__: this };
},

/**
Expand Down