TopClass update

Hey all,

I updated TopClass, which is basically a syntactically nice version of the Douglas Crockford Module Pattern. It no longer relies on any libraries.

It also has support for instances of a class that have their own public/private stuff. So: that moves it away from just being a singleton. These instances have a concept of parentClass and the parentClass has knowledge of the instances it has created. Allows you to do some pretty cool things. Comment if you want me to explain that part of it a little more.

Otherwise, just syntactically writing Douglas Crockford’s method is nice:


var MyThing = TopClass({
publicMethods: {
publicFunction: function() { //do something useful },
otherPublicFunction: function() { // do something more useful }
},
privateMethods: {
privateVar: "I'm private",
privateFunction() { //I can only be called by the public functions above }
}
});

6 Responses to “TopClass update”

  1. Don’t Quibble with Quimble » Blog Archive » Update your DOM with JSON from the server Says:

    […] Ajax calls which render HTML from the server can sometimes get hard to manage. This little module will take JSON from your server and render it with a template that’s already in your HTML. I’ll explain it more later. You’ll need to be using TopClass. […]

  2. Daniel M. Lambea Says:

    Very interesting code, really. Thank you very much for publishing. What is the license?

  3. Topper Says:

    Daniel,

    Thanks. Please feel free to do whatever you want with the code. If you change it, I’d love to hear what you’ve done.

  4. Michiel van der Blonk Says:

    I get an error in this script on privateFunction “missing : after property id”. I think it should be “privateFunction: function() {}”

  5. Anonymous Says:

    Office 2007 Professional
    Office 2007 Ultimate
    Office Professional 2007
    Office Ultimate 2007
    MS Office 2007

  6. Anonymous Says:

    With DWG to PDF Converter, you can convert files from any Windows software application to over 150 file types including searchable PDF, DWG, TIFF, JPEG etc, as easy as printing the file. Converting your DWG files to PDF has never been easier! Combine several DWG files into a single PDF file, convert a CAD file into a PDF file, or convert DWG to ANY file format!

    This DWG Converter can batch convert multiple files such as DWG to DWF, DXF, SVG as well as to PDF, PLT(HPGL), SVG, EPS, CGM, BMP, JPEG, TIFF, PCX, WMF, PNG without the need of AutoCAD. Merge multiple DWG files into one PDF file is also supported.

Leave a Reply

Logged in as . Logout »