{"id":32234691,"url":"https://github.com/cedmax/akase","last_synced_at":"2025-10-22T12:52:15.201Z","repository":{"id":7177137,"uuid":"8478965","full_name":"cedmax/akase","owner":"cedmax","description":"🌌 a small decoupled, event-driven architectural framework","archived":false,"fork":false,"pushed_at":"2016-12-03T20:50:32.000Z","size":124,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-12T23:41:29.473Z","etag":null,"topics":["amd","architecture","javascript","modular","requirejs"],"latest_commit_sha":null,"homepage":"https://akase.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedmax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-28T12:44:13.000Z","updated_at":"2021-07-14T15:07:01.000Z","dependencies_parsed_at":"2022-08-19T21:41:03.899Z","dependency_job_id":null,"html_url":"https://github.com/cedmax/akase","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cedmax/akase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedmax%2Fakase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedmax%2Fakase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedmax%2Fakase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedmax%2Fakase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedmax","download_url":"https://codeload.github.com/cedmax/akase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedmax%2Fakase/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280439995,"owners_count":26331171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amd","architecture","javascript","modular","requirejs"],"created_at":"2025-10-22T12:52:12.886Z","updated_at":"2025-10-22T12:52:15.186Z","avatar_url":"https://github.com/cedmax.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ākāśe [![Build Status](https://travis-ci.org/cedmax/akase.png?branch=master)](https://travis-ci.org/cedmax/akase)\n\nākāśe (sanskrit for \"in the sky\"/\"to the sky\") is a small decoupled, event-driven architecture framework.\nIt is based on Nicholas Zakas [Scalable Javascript Application Architecture](http://www.slideshare.net/nzakas/scalable-javascript-application-architecture-2012) and [RequireJS and AMD](http://www.slideshare.net/iivanoo/requirejs-12937421).\n\n## Concepts\nThe concepts of the framework are well represented by the two presentations linked above.\nBasically everything gets sandboxed and everyone is happy. ([play with it](https://github.com/cedmax/akase-playground))\n\n## Modules \u0026 Sandbox\nThe modules you will have to create are proper AMD modules with this skeleton\n\n```js\ndefine(function(){\n    'use strict';\n\n    return function(sandbox){\n\n        //the logic of the module\n        function doSomething(){\n            //do something\n        }\n\n        return {\n            init:function(config){\n                //the initialization code\n                sandbox.subscribe('myEventName', doSomething)\n            },\n            destroy: function(){\n                //optional destroy method, useful to remove callbacks from DOM event\n            }\n        };\n\n    };\n});\n```\n\nAs in the example, every module has access to the sandbox, which is supposed to be the only external api accessible, but no one forces you not to require a framework (watch out that you are coupling your code with that specific framework, just saying)\n\n```js\ndefine(['jQuery'], function($){\n    'use strict';\n\n    return function(sandbox){\n\n        function doSomething(){\n            //do something\n        }\n\n        return {\n            init:function(config){\n                $('#myElm').on('click', doSomething);\n            }\n        };\n    };\n});\n```\n\nThe sandbox API should be defined/extended by you, the only API available out of the box allows to:\n\n- access the module name\n\n        sandbox.module\n\n- publish an event through the whole architecture\n\n        sandbox.publish(eventName, payload)\n\n    Parameters:\n    - eventName _String_ - the name of the event\n    - payload _Object_ - the optional payload to be sent to the subscribing modules\u003cbr/\u003e\u003cbr/\u003e\n\n- subscribe to an event\n\n        sandbox.subscribe(eventName(s), callback)\n\n    Parameters:\n    - eventName(s) _String|Array[String]_ - the event(s) the module will subscribe to\n    - callback _Function_ - the callback to be invoked (the payload will be injected as argument)\u003cbr/\u003e\u003cbr/\u003e\n\n- namespace your own Api\n\n        sandbox.api\n\n\n## Setup \u0026 Core\nEverything gets started in a proper RequireJS way\n\n    \u003cscript data-main=\"main.js\" src=\"/assets/javascripts/require.js\"\u003e\u003c/script\u003e\n\n\nThe main file should require ākāśe core lib in order to take advantage of the framework\n\n    require(['akase'], function(core) {\n        //[...]\n    });\n\n\nthe core exposes 3 methods in order to:\n\n- load and initialize a module\n\n        start(moduleId, options)\n\n    Parameters:\n    - moduleId _String_ - the name of the module\n    - options _Object_ - 2 properties allowed:\n        - config _Object_ - a configuration object to be injected in the init of the module\n        - event _String_ - an event that drives the module start\n        - waitForConfig _Boolean_ - (added in v1.1.0) if true the module would wait until a global object `akase.config.moduleName` is available and will extend the inlined config with it. Useful if you need dynamic data from the page (example below).\u003cbr/\u003e\u003cbr/\u003e\n\n- stop and undefine the module (next start will reload the resource)\n\n        stop(moduleId)\n\n    Parameters:\n    - moduleId (String) - the name of the module\u003cbr/\u003e\u003cbr/\u003e\n\n- broadcast events into the architecture, it works as the sandbox.publish\n\n        notify(event, payload)\n\n    Parameters:\n    - eventName _String_ - the name of the event\n    - payload _Object_ - the optional payload to be sent to the subscribing modules\u003cbr/\u003e\u003cbr/\u003e\n\n\nexample of a proper main.js\n\n```js\nrequire(['akase', 'module1', 'module2', 'module3', 'module4'], function(core) {\n\n    var audio  = document.createElement(\"audio\"),\n    canPlayMP3 = (typeof audio.canPlayType === \"function\" \u0026\u0026 audio.canPlayType(\"audio/mpeg\") !== \"\");\n\n    core.start(\"module1\", {\n        config: {\n            hasMp3Support: canPlayMP3\n        }\n    });\n\n    core.start(\"module2\");\n    core.start(\"module3\", { event: \"audio:stop\" });\n});\n```\n\n**Wait for config** (*added in v1.1.0*)\n```js\n    core.start(\"module4\", { waitForConfig: true})\n```\nIn this case the core would wait for a global configuration on the global `akase` object before starting `module4`. \nVery useful if you need to pass dynamic data from the page rendered by the server to the application.\n\n```js\nakase.config['module4'] = {\n    productId: 'AGS1241S'\n}\n```\nThe core is re-checking for 5 seconds and then give up, no error thrown.\n\n\u003cbr/\u003e\u003cbr/\u003e\nIn order to have RequireJS proper loading modules you'd read [RequireJS documentation](http://www.requirejs.org/) to configure the paths\n\n#Thanks\nTo all the guys that helped me creating ākāśe with their inspiration or making me copy their ideas: [Marco Pracucci](https://github.com/pracucci), [Rocco Zanni](https://github.com/roccozanni), [Luca Lischetti](https://github.com/sirlisko), [Rocco Curcio](https://github.com/jsDotCr)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedmax%2Fakase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedmax%2Fakase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedmax%2Fakase/lists"}