{"id":20947744,"url":"https://github.com/alphahydrae/clah","last_synced_at":"2025-05-14T02:30:28.906Z","repository":{"id":4336091,"uuid":"5471764","full_name":"AlphaHydrae/clah","owner":"AlphaHydrae","description":"Simple Javascript Inheritance (by John Resig) with bound callbacks.","archived":false,"fork":false,"pushed_at":"2018-09-07T06:58:52.000Z","size":19,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-10T07:02:21.577Z","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/AlphaHydrae.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":"2012-08-19T15:10:40.000Z","updated_at":"2018-09-07T06:58:53.000Z","dependencies_parsed_at":"2022-09-16T14:51:20.644Z","dependency_job_id":null,"html_url":"https://github.com/AlphaHydrae/clah","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fclah","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fclah/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fclah/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fclah/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlphaHydrae","download_url":"https://codeload.github.com/AlphaHydrae/clah/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225270612,"owners_count":17447635,"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-11-19T00:12:53.376Z","updated_at":"2024-11-19T00:12:53.963Z","avatar_url":"https://github.com/AlphaHydrae.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clah\n\n**Simple JavaScript Inheritance with bound callbacks**\n\nAll credit for the inheritance system goes to John Resig. I adapted it to work both with [Node.js](http://nodejs.org) or in a browser, and added a function to generate bound callbacks.\n\n```js\n// define a class\nvar Person = Class.extend({\n\n  // this is the constructor\n  init : function(name) {\n    this.name = name;\n  },\n\n  // you can use instance properties in your methods\n  hello : function() {\n    console.log(\"Hello, I'm \" + this.name + \"!\");\n  }\n});\n\n// define a subclass\nvar Pirate = Person.extend({\n\n  // you can override methods\n  hello : function() {\n    console.log(\"Ahoy! Me be \" + this.name + \".\");\n  }\n});\n\nnew Person('Jim').hello();    // #=\u003e \"Hello, I'm Jim!\"\nnew Pirate('John').hello();   // #=\u003e \"Ahoy! Me be John.\"\n\n// create a bound callback\nvar jane = new Person('Jane');\nvar callback = jane.callback('hello');\n\n// you can use this callback anywhere, it will always be bound to the instance\ncallback();   // #=\u003e \"Hello, I'm Jane!\"\n```\n\nClah is tested with [Jasmine](https://jasmine.github.io/) and [Travis CI](http://travis-ci.org).\n\n* master [![Build Status](https://secure.travis-ci.org/AlphaHydrae/clah.png?branch=master)](http://travis-ci.org/AlphaHydrae/clah)\n* develop [![Build Status](https://secure.travis-ci.org/AlphaHydrae/clah.png?branch=develop)](http://travis-ci.org/AlphaHydrae/clah)\n\n## Installation\n\nWith [NPM](https://npmjs.org):\n\n    npm install clah\n\nIn a browser:\n\n    \u003cscript type='text/javascript' src='/path/to/your/assets/clah.min.js'\u003e\u003c/script\u003e\n\nDownload: [Production (minified)](https://raw.github.com/AlphaHydrae/clah/master/lib/class.min.js), [Development (uncompressed)](https://raw.github.com/AlphaHydrae/clah/master/lib/class.js).\n\n[Original Blog Post](http://ejohn.org/blog/simple-javascript-inheritance/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphahydrae%2Fclah","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falphahydrae%2Fclah","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphahydrae%2Fclah/lists"}