{"id":16181779,"url":"https://github.com/ericclemmons/mootools-namespace","last_synced_at":"2025-03-19T02:30:31.801Z","repository":{"id":770159,"uuid":"454931","full_name":"ericclemmons/mootools-namespace","owner":"ericclemmons","description":"Allows Classes to specify namespace (\"My.Fx.Accordion\") and extend \"Moo.Fx.Accordion\", similar to Dojo.provide/require","archived":false,"fork":false,"pushed_at":"2010-08-26T04:56:24.000Z","size":228,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T06:27:29.229Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ericclemmons.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":"2010-01-01T03:03:11.000Z","updated_at":"2014-03-09T06:31:10.000Z","dependencies_parsed_at":"2022-07-18T12:48:16.587Z","dependency_job_id":null,"html_url":"https://github.com/ericclemmons/mootools-namespace","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericclemmons%2Fmootools-namespace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericclemmons%2Fmootools-namespace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericclemmons%2Fmootools-namespace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericclemmons%2Fmootools-namespace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericclemmons","download_url":"https://codeload.github.com/ericclemmons/mootools-namespace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221720240,"owners_count":16869445,"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","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":[],"created_at":"2024-10-10T06:27:39.210Z","updated_at":"2024-10-27T18:59:38.912Z","avatar_url":"https://github.com/ericclemmons.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#   Mootools Namespace\n\n![Screenshot](http://github.com/ericclemmons/mootools-namespace/raw/master/screenshot.png)\n\nAllow `Class` declarations to support [Dojo-like packaging \u0026 namespacing][dojo].\nFor example, `My.Widget.Growl` would extend `My.Widget.Tips` and require\n`Moo.Core.Request.HTML`:\n    \n    new Namespace(\"My.Widget.Growl\", {\n        Requires: \"Moo.Core.Request.HTML\",\n        Extends: \"My.Widget.Tooltip\",\n        ...\n    });\n\n##  Why?\n\nEnterprise-level development, in my experience, requires organization \u0026 quality\non the client-side that is normally seen on the server-side.  Simply put, you would\nfind Zend Framework namespaced in the `/library/Zend/...` folder and, similarly, the\nclient-side scripts would likely be located in `/public/js/my/...`, where `my` is your\ncompany or project name.\n\nA good example of Javascript namespacing can be found in my tutorial\n[Making Your Own Growl Widget With Dojo][growl].\n\n##  Current Limitations\n\nAs Mootools is not yet namespaced (aside from folder structure), I've forked the\n[Mootools Core][core] and [Mootools More][more] repositories to clean up structure\nfor autoloading \u0026 implement namespacing.  For example, `Fx.Tween` becomes\n`Moo.Core.Fx.Tween`.  `Element.tween` continues to work, as well as `new Fx.Tween`.\n\nRemember, this grew out of the need for namespacing within existing enterprise-level\ncode, not for improving upon Mootools' pseudo-namespacing.\n\n## How to Use\n\nSuppose you have a custom Growl widget that you would like on your current page...\n\n### Include Namespace.class.js\n\n*Remember, `Class.Extras` and `Request` are required for Namespace to work.*\n\n    \u003cscript src=\"js/Namespace.class.js\"\u003e\n\nThe base-path has been set to `js` automatically, as that is where the script is located.\n\n### (Optional) Set the base-path to your modules\n\n    \u003cscript\u003e\n        Namespace.setBasePath(\"My\", \"js/NotMine\");\n    \u003c/script\u003e\n\n### Either `require` your widget...\n\n    \u003cscript\u003e\n        Namespace.require(\"My.Widget.Growl\");\n        // SJAX request to js/NotMine/Widget/Growl.js\n        // If base-path is default, it would go to:\n        //   js/My/Widget/Growl.js\n        \n        new My.Widget.Growl(\"Howdy There!\");\n    \u003c/script\u003e\n\n### ...or make it a dependency for a new class...\n\n    \u003cscript\u003e\n        new Namespace(\"My.Login.Page\", {\n            Extends: \"My.Widget.Growl\",\n            \n            initialize: function(message) {\n                this.parent(message);\n            }\n        });\n        \n        new My.Login.Page(\"Howdy There\");\n    \u003c/script\u003e\n\nBecause the `Extends` class is in quotes, it is automatically loaded.  Had it not\nbeen in quotes, the class/namespace would have to exist before-hand.\n\n## Example - Require entire library\n\nOften in large applications, you will need a whole library in the beginning to\nprevent any delayed execution of events (animations, AJAX calls, etc.).\n\nIn the following example, we have an application that has a login page that may\nallow the user to register or login with an existing account.  There may be specific\nanimations only used in this page, custom validation for the forms and their respective\ntemplates, as well as events associated with elements on the page.\n\n### Folder Structure\n\n    /public\n        /application\n        /library\n        /js\n            /Moo\n                /Core\n                /More\n                Namespace.js\n            /My\n                /Login\n                    /Templates\n                        Register.html\n                        Login.html\n                    All.js\n                    Animations.js\n                    Events.js\n                    Form.js\n                    Fx.js\n\n### HTML - index.html\n\n    \u003c!-- Include the namespacing functionality --\u003e\n    \u003cscript src=\"js/Moo/Namespace.js\"\u003e\u003c/script\u003e\n    \n    \u003c!-- Now, require  --\u003e\n    \u003cscript src=\"js/My/Login/All.js\"\u003e\u003c/script\u003e\n\n### Javascript - /js/My/Login/All.js\n\n    new Namespace(\"My.Login.All\", {\n        Requires: [\n            \"My.Login.Animations\",\n            \"My.Login.Events\",\n            \"My.Login.Form\",\n            \"My.Login.Fx\"\n        ]\n    });\n\n## Demos\n\nSee the /demos folder.\n\n[dojo]: http://docs.dojocampus.org/dojo/index#package-system\n[wf]:   http://www.whitefence.com/\n[growl]:http://blog.uxdriven.com/2009/09/08/making-your-own-growl-widget-with-dojo/\n[core]: git@github.com:ericclemmons/mootools-core.git\n[more]: git@github.com:ericclemmons/mootools-more.git","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericclemmons%2Fmootools-namespace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericclemmons%2Fmootools-namespace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericclemmons%2Fmootools-namespace/lists"}