From e0bd2619fa025d32ef08e7bd47152f337529b761 Mon Sep 17 00:00:00 2001 From: Alex Murzina Date: Mon, 30 Oct 2017 11:28:37 +1100 Subject: [PATCH 01/23] Added a fix to the code that is failing --- Core.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Core.js b/Core.js index c5fc1ab..6ce6248 100644 --- a/Core.js +++ b/Core.js @@ -732,25 +732,25 @@ if(typeof window != 'undefined') { old_onresize = window.onresize || document.body.onresize; } - FireEvent(new DOM_Init()); + Core.FireEvent(new DOM_Init()); - FireEvent(new DOM_Changed({element: document.body})); + Core.FireEvent(new DOM_Changed({element: document.body})); window.onscroll = document.body.onscroll = function(event) { if(old_onscroll) { old_onscroll(event); } - FireEvent(new Window_Scroll({dom_event: event})); + Core.FireEvent(new Window_Scroll({dom_event: event})); }; window.onresize = document.body.onresize = function(event) { if(old_onresize) { old_onresize(event); } - FireEvent(new Window_Resize({dom_event: event})); + Core.FireEvent(new Window_Resize({dom_event: event})); }; window.onbeforeunload = function(event) { - FireEvent(new DOM_Unload({dom_event: event})); + Core.FireEvent(new DOM_Unload({dom_event: event})); }; }); From 0c4b654834dfeb3599543f3a70057bbf9f27323d Mon Sep 17 00:00:00 2001 From: Alex Murzina Date: Thu, 2 Nov 2017 18:30:39 +1100 Subject: [PATCH 02/23] upadted version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09a34d7..ae81543 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "core-os", - "version": "0.1.5", + "version": "0.1.6", "description": "Awesome event oriented javascript framework", "main": "Core.js", "directories": { From c5d3f772e4b4b12ac60991c961bfbdfb498c37d5 Mon Sep 17 00:00:00 2001 From: Alex Murzina Date: Thu, 2 Nov 2017 18:31:24 +1100 Subject: [PATCH 03/23] updated bower version --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 18620b0..c49feac 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "core-os", - "version": "0.1.5", + "version": "0.1.6", "homepage": "https://github.com/extremeprog-com/core", "authors": [ "(Oleg Sergienko )" From 8c943d54660bf90ab1d4c242f0abc3031fd9aaa2 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 00:24:41 +1000 Subject: [PATCH 04/23] Update README.md --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cbb4a06..6a0b863 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,22 @@ # CoreJS -Awesome Event Oriented Javascript Framework +This is the simple JS implementation of CORE design pattern -This framework provide us with new principles of the design of the code. The main idea is that the hole project is a set of modules. Every module has it's own objects. Some objects may have Events and Requests. +This framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. + +The ideas in the base of it are similar to following approaches, and it collects the best benefits of them: + +- automata-based programming +- actor model +- system of signals and slots +- event-oriented programming + +CORE means: Contexts, Objects, Requests and Events Event is a complex object, that means that something has already happend. Request is a complex object, that means that something asks to perform its request. -Other objects of the system can subscribe to Events and Requests. Subscription is a static process. -During initialization Core parses project and subscribes objects on Events and Requests. +Other objects of the system can subscribe to Events and Requests. Subscription is a static process (which is *difference* to usual *obj.fire('event')* and *obj.on('event)* dynamic-style subscriptions). +During initialization Core parses code of methods and subscribes objects on Events and Requests statically. # Installing @@ -64,7 +73,7 @@ var GoogleTrackingObject = { sendPlayerEvents: function() { var event = CatchEvent(Player_Started, Player_Paused); - ga('send', 'event', 'player', 'player_event'); + ga('send', 'event', 'player', 'player_event', event.type); } } ``` @@ -147,6 +156,8 @@ var Player = { ## States +It's an example how we can implement more complicated object's behaviour and use it in CORE-style. + ### Description #### Usage ```javascript From 5c303877f16217d129b65242db871352c20aeb26 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 00:25:20 +1000 Subject: [PATCH 05/23] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a0b863..ed23592 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # CoreJS This is the simple JS implementation of CORE design pattern +CORE means: Contexts, Objects, Requests and Events + This framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. The ideas in the base of it are similar to following approaches, and it collects the best benefits of them: @@ -10,8 +12,6 @@ The ideas in the base of it are similar to following approaches, and it collects - system of signals and slots - event-oriented programming -CORE means: Contexts, Objects, Requests and Events - Event is a complex object, that means that something has already happend. Request is a complex object, that means that something asks to perform its request. From 5cbfbb672f283ecd73a82e5b45b934251d3f3ce8 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 00:26:24 +1000 Subject: [PATCH 06/23] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index ed23592..d3f071b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # CoreJS -This is the simple JS implementation of CORE design pattern - -CORE means: Contexts, Objects, Requests and Events +This is the simple JS implementation of *CORE design pattern* (acronym: Contexts, Objects, Requests and Events) This framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. From 0d2a93a078b12decc050852e53c16f019d4443b9 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 00:27:04 +1000 Subject: [PATCH 07/23] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d3f071b..520fd30 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # CoreJS -This is the simple JS implementation of *CORE design pattern* (acronym: Contexts, Objects, Requests and Events) +This is the simple JS implementation of **CORE design pattern** (acronym: Contexts, Objects, Requests and Events) This framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. @@ -13,7 +13,7 @@ The ideas in the base of it are similar to following approaches, and it collects Event is a complex object, that means that something has already happend. Request is a complex object, that means that something asks to perform its request. -Other objects of the system can subscribe to Events and Requests. Subscription is a static process (which is *difference* to usual *obj.fire('event')* and *obj.on('event)* dynamic-style subscriptions). +Other objects of the system can subscribe to Events and Requests. Subscription is a static process (which is *difference* to usual **obj.fire('event')** and **obj.on('event)** dynamic-style subscriptions). During initialization Core parses code of methods and subscribes objects on Events and Requests statically. # Installing From 52bdb6fab37e84f84bb98e517632b9c1b124a6c3 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 00:28:28 +1000 Subject: [PATCH 08/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 520fd30..3a43ffd 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The ideas in the base of it are similar to following approaches, and it collects Event is a complex object, that means that something has already happend. Request is a complex object, that means that something asks to perform its request. -Other objects of the system can subscribe to Events and Requests. Subscription is a static process (which is *difference* to usual **obj.fire('event')** and **obj.on('event)** dynamic-style subscriptions). +Other objects of the system can subscribe to Events and Requests. Subscription is a static process (which is **different** to usual **obj.fire('event')** and **obj.on('event)** dynamic-style subscriptions). During initialization Core parses code of methods and subscribes objects on Events and Requests statically. # Installing From a0c84b2c7a5c295f5a8d4c59caf3d43f3acd5bcc Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 01:04:26 +1000 Subject: [PATCH 09/23] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3a43ffd..3bab07a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # CoreJS -This is the simple JS implementation of **CORE design pattern** (acronym: Contexts, Objects, Requests and Events) +This framework is the simple JS implementation of **CORE design pattern** (acronym: Contexts, Objects, Requests and Events) -This framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. +This design pattern and the framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. The ideas in the base of it are similar to following approaches, and it collects the best benefits of them: @@ -14,7 +14,9 @@ Event is a complex object, that means that something has already happend. Request is a complex object, that means that something asks to perform its request. Other objects of the system can subscribe to Events and Requests. Subscription is a static process (which is **different** to usual **obj.fire('event')** and **obj.on('event)** dynamic-style subscriptions). -During initialization Core parses code of methods and subscribes objects on Events and Requests statically. +During initialization CORE framework parses the code of methods and subscribes objects on Events and Requests statically. +Note that 99% of real-world cases don't need a dynamic behaviour, which is a good base to simplify this process +Static approach also offers you an ability to build a map how objects/methods are connected, and analyse it, which can extend your Static Code Analysis Tool benefits of your project. # Installing From 8d77bc32004bbbc3e1ba82698f8b7d6ce577c661 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 01:22:04 +1000 Subject: [PATCH 10/23] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3bab07a..1385c9b 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,15 @@ The ideas in the base of it are similar to following approaches, and it collects - event-oriented programming Event is a complex object, that means that something has already happend. + Request is a complex object, that means that something asks to perform its request. Other objects of the system can subscribe to Events and Requests. Subscription is a static process (which is **different** to usual **obj.fire('event')** and **obj.on('event)** dynamic-style subscriptions). + During initialization CORE framework parses the code of methods and subscribes objects on Events and Requests statically. + Note that 99% of real-world cases don't need a dynamic behaviour, which is a good base to simplify this process + Static approach also offers you an ability to build a map how objects/methods are connected, and analyse it, which can extend your Static Code Analysis Tool benefits of your project. # Installing @@ -25,6 +29,7 @@ Static approach also offers you an ability to build a map how objects/methods ar ## Events ### Description There are three steps for using Events: initialization, firing, catching. + You can pass some data with Event. ### Example @@ -50,6 +55,7 @@ To fire Event call `FireEvent` function with created Event. #### Catching The main twist is that you can catch the fired Event at any spaces of your code. + So this can cut your code several times. Also you can dinamically subscribe to the event. It is useful in different cases, for example, in angular directives. From e06ac71e490c73b54fc983eb3515889aaca07704 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 02:02:36 +1000 Subject: [PATCH 11/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1385c9b..7f2d510 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# CoreJS +# CoreJS - a way out of overly complicated code This framework is the simple JS implementation of **CORE design pattern** (acronym: Contexts, Objects, Requests and Events) This design pattern and the framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. From 53f57f07fe1a4eee0b67846acb160c524ec7b20b Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 02:05:23 +1000 Subject: [PATCH 12/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f2d510..251d99d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# CoreJS - a way out of overly complicated code +# CORE for JS - to code closely to how you think. Write less, do more. This framework is the simple JS implementation of **CORE design pattern** (acronym: Contexts, Objects, Requests and Events) This design pattern and the framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. From 1657f97cc7c0df672296ea23a43f8903a21f5258 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 02:05:52 +1000 Subject: [PATCH 13/23] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 251d99d..17196f7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# CORE for JS - to code closely to how you think. Write less, do more. +# CORE for JS - code closely to how you think + +## Write less, do more + This framework is the simple JS implementation of **CORE design pattern** (acronym: Contexts, Objects, Requests and Events) This design pattern and the framework provide you ability to easily design and implement well structured, high cohesioned, and low coupled modular systems using Events and Requests. The benefit of that approach is a semantic which is highly close to Business Logic, which allows to write less code doing more, and have less bugs and debugging with it. From 2c36e08291707d14e714c8e80f446da383b5b849 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 02:08:25 +1000 Subject: [PATCH 14/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 17196f7..5dfe1c5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# CORE for JS - code closely to how you think +# CORE for JS - write code close to how you think ## Write less, do more From b77b2afea51d10e634faad07b39dde74c377c013 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 02:09:39 +1000 Subject: [PATCH 15/23] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5dfe1c5..a9669e7 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ Note that 99% of real-world cases don't need a dynamic behaviour, which is a goo Static approach also offers you an ability to build a map how objects/methods are connected, and analyse it, which can extend your Static Code Analysis Tool benefits of your project. +High-level description: https://medium.com/@_os/core-design-pattern-the-way-out-from-overly-complicated-code-b8804449941 + # Installing # API From 04207751f7c87ad0dbf02d7cf1b6f5f834cd5d44 Mon Sep 17 00:00:00 2001 From: okneigres Date: Thu, 12 Jul 2018 02:17:56 +1000 Subject: [PATCH 16/23] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a9669e7..017fb2b 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ Static approach also offers you an ability to build a map how objects/methods ar High-level description: https://medium.com/@_os/core-design-pattern-the-way-out-from-overly-complicated-code-b8804449941 +How to help the project: https://medium.com/ux-of-programming-languages/lets-build-a-community-around-core-701eb8ebb02c + # Installing # API From c7b4a943a845ab86348251c80032d3eb5efb03cf Mon Sep 17 00:00:00 2001 From: okneigres Date: Mon, 16 Jul 2018 02:59:34 +1000 Subject: [PATCH 17/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 017fb2b..8fb9a53 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Note that 99% of real-world cases don't need a dynamic behaviour, which is a goo Static approach also offers you an ability to build a map how objects/methods are connected, and analyse it, which can extend your Static Code Analysis Tool benefits of your project. -High-level description: https://medium.com/@_os/core-design-pattern-the-way-out-from-overly-complicated-code-b8804449941 +High-level description: https://medium.com/@i_am_os/core-design-pattern-the-way-out-from-overly-complicated-code-b8804449941 How to help the project: https://medium.com/ux-of-programming-languages/lets-build-a-community-around-core-701eb8ebb02c From 0ce12a787e35638fb64b491ff096c85f53834206 Mon Sep 17 00:00:00 2001 From: Alex Murzina Date: Thu, 7 Mar 2019 13:09:45 +1100 Subject: [PATCH 18/23] add types for typescript support --- .gitignore | 1 + index.d.ts | 13 +++++++++++++ package.json | 1 + 3 files changed, 15 insertions(+) create mode 100644 index.d.ts diff --git a/.gitignore b/.gitignore index f32e31a..2144dcd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ .DS_Store +.package.json.swp \ No newline at end of file diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..7720ef8 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,13 @@ +interface Core { + FireEvent (Request: CoreRequest, success?: Function, fail?: Function) :void; + FireRequest(Event : CoreEvent) :void; + + CatchEvent(...args: any) : CoreRequest; + CatchRequest(...args: any): CoreRequest; + + detachObject (Object: Object): Object; + processObject(Object: Object): Object; +} + +declare type CoreRequest = { _request: string } & {[key: string]: any}; +declare type CoreEvent = { _event : string } & {[key: string]: any}; \ No newline at end of file diff --git a/package.json b/package.json index ae81543..f5711ed 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "types": "./index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/extremeprog-com/core.git" From ed333c834414fc318588e80ac38424bd01a9d2d6 Mon Sep 17 00:00:00 2001 From: Alex Murzina Date: Thu, 7 Mar 2019 13:13:12 +1100 Subject: [PATCH 19/23] new version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5711ed..45cd5da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "core-os", - "version": "0.1.6", + "version": "0.1.7", "description": "Awesome event oriented javascript framework", "main": "Core.js", "directories": { From 1bd67ca5d800e3c25a4fec46d4fa42ba544c112c Mon Sep 17 00:00:00 2001 From: Alex Murzina Date: Thu, 7 Mar 2019 18:09:03 +1100 Subject: [PATCH 20/23] updates in types --- index.d.ts | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 7720ef8..9958299 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,3 +1,5 @@ +declare module "core-os"; + interface Core { FireEvent (Request: CoreRequest, success?: Function, fail?: Function) :void; FireRequest(Event : CoreEvent) :void; diff --git a/package.json b/package.json index 45cd5da..492c83a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "core-os", - "version": "0.1.7", + "version": "0.1.8", "description": "Awesome event oriented javascript framework", "main": "Core.js", "directories": { From f97486cd4741273b3e869ebc4f34af261eac4ff7 Mon Sep 17 00:00:00 2001 From: Alex Murzina Date: Tue, 30 Jul 2019 10:40:22 +1000 Subject: [PATCH 21/23] Added a special check to the processObject method to make sure it does not process constructor methods which is an issue --- .gitignore | 3 ++- CHANGELOG.md | 10 ++++++++++ Core.js | 3 ++- LICENCE.txt | 23 +++++++++++++++++++++++ index.d.ts | 6 +++--- 5 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 LICENCE.txt diff --git a/.gitignore b/.gitignore index 2144dcd..fbcb2ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ .DS_Store -.package.json.swp \ No newline at end of file +.package.json.swp +*.iml \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..be26d74 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +### Core 0.1.9 + +- Added a special check to the processObject method to make sure it does not process constructor methods which is an issue +for some cases when Javascript precompilers which add constructor as a enumerable property to classes. + +- Added a licence file (MIT) + +### Core 0.1.8 + +- Added support for @types for Typescript. \ No newline at end of file diff --git a/Core.js b/Core.js index 6ce6248..82d1f8f 100644 --- a/Core.js +++ b/Core.js @@ -501,9 +501,10 @@ Core = { } for( var method in _class ) { var events; + var isConstructor = method === 'constructor'; // some precompilers add constructor as a enumerable property which causes side-effects in Core var isGetter = _class instanceof Object && Object.getOwnPropertyDescriptor(_class, method) && Object.getOwnPropertyDescriptor(_class, method).get; // check if property is actually getter to prevent getters from calling (it can be js errors because of calling) - if (!isGetter && _class[method] instanceof Function ) { + if (!isGetter && _class[method] instanceof Function && !isConstructor ) { if( events = _class[method].toString().replace(/\n/g,"").match(/(Core\.)?(CatchEvent|CatchRequest)\(([^\)]+)\)/m) ) { events = events[3].replace(/^[ \t\n\r]*|[ \t\n\r]*$/mg,"").split(/[ \t\n\r]*,[ \t\n\r]*/); for( var i = 0; i < events.length; i++ ) { diff --git a/LICENCE.txt b/LICENCE.txt new file mode 100644 index 0000000..051a4e1 --- /dev/null +++ b/LICENCE.txt @@ -0,0 +1,23 @@ +MIT License (MIT) + +Copyright (c) 2016 extremeprog-com + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index 9958299..5dbd4f9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4,12 +4,12 @@ interface Core { FireEvent (Request: CoreRequest, success?: Function, fail?: Function) :void; FireRequest(Event : CoreEvent) :void; - CatchEvent(...args: any) : CoreRequest; + CatchEvent (...args: any): CoreEvent; CatchRequest(...args: any): CoreRequest; detachObject (Object: Object): Object; processObject(Object: Object): Object; } -declare type CoreRequest = { _request: string } & {[key: string]: any}; -declare type CoreEvent = { _event : string } & {[key: string]: any}; \ No newline at end of file +declare interface CoreRequest { _request: string, [key: string]: any} +declare interface CoreEvent { _event : string, [key: string]: any} \ No newline at end of file From 46a35cfffc4af67227830edb4681936251cb49fd Mon Sep 17 00:00:00 2001 From: Alex Murzina Date: Tue, 30 Jul 2019 10:49:15 +1000 Subject: [PATCH 22/23] updated version in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 492c83a..22c7488 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "core-os", - "version": "0.1.8", + "version": "0.1.9", "description": "Awesome event oriented javascript framework", "main": "Core.js", "directories": { From 360e9ece9116c2215fa3e5f94d2838736ca33fff Mon Sep 17 00:00:00 2001 From: myfoxtail <{ID}+{username}@users.noreply.github.com> Date: Thu, 17 Sep 2020 11:15:36 +1000 Subject: [PATCH 23/23] enhanced typescript support to make it easier to create type definitions for Core Events and Requests --- CHANGELOG.md | 6 ++++++ index.d.ts | 15 +++++++++------ package.json | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be26d74..4a38886 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# Changelog + +### Core 0.1.10 + +- Enhanced typescript support to make it easier to create type definitions for Core Events and Requests. + ### Core 0.1.9 - Added a special check to the processObject method to make sure it does not process constructor methods which is an issue diff --git a/index.d.ts b/index.d.ts index 5dbd4f9..784cdbd 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,15 +1,18 @@ declare module "core-os"; interface Core { - FireEvent (Request: CoreRequest, success?: Function, fail?: Function) :void; - FireRequest(Event : CoreEvent) :void; + FireEvent (Request: CoreRequest, success?: Function, fail?: Function) :void; + FireRequest(Event : CoreEvent) :void; - CatchEvent (...args: any): CoreEvent; - CatchRequest(...args: any): CoreRequest; + CatchEvent (...args: any): CoreEvent; + CatchRequest(...args: any): CoreRequest; detachObject (Object: Object): Object; processObject(Object: Object): Object; } -declare interface CoreRequest { _request: string, [key: string]: any} -declare interface CoreEvent { _event : string, [key: string]: any} \ No newline at end of file +declare interface CoreRequest { _request: request, [key: string]: any} +declare interface CoreRequestConstructor { new (parameters?: any): CoreRequest; } + +declare interface CoreEvent { _event : event, [key: string]: any} +declare interface CoreEventConstructor { new (parameters?: any): CoreEvent; } \ No newline at end of file diff --git a/package.json b/package.json index 22c7488..e05b262 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "core-os", - "version": "0.1.9", + "version": "0.1.10", "description": "Awesome event oriented javascript framework", "main": "Core.js", "directories": {