Using base2.js but no code assist

Get help with Spket IDE.
Post Reply
joe
Posts: 4
Joined: Mon Apr 26, 2010 3:36 pm

Using base2.js but no code assist

Post by joe » Mon Apr 26, 2010 4:03 pm

I use base2.js (written by Dean Edwards) in my project. But the code assist never run. I test the sample code with base2.js as the following to test. It's the same:

Code: Select all

/**
 * @include "lib/base2/src/base2.js"
 */
new function(_) { // create the closure
  // create the package object
  var shapes = new base2.Package(this, {
    name:    "shapes",
    version: "1.0",
    exports: "PI,Circle,Rectangle"
  });
  
  // evaluate the imported namespace
  eval(this.imports); 
  
  var PI = 3.14;
  
  var Shape = Base.extend({
    constructor: function(x, y) {
      this.move(x, y);
    },
    x: 0,
    y: 0,
    getArea: Undefined,
    move: function(x, y) {
      this.x = Number(x);
      this.y = Number(y);
    }
  });
  
  var Circle = Shape.extend({
    constructor: function(x, y, radius) {
      this.base(x, y);
      this.radius = Number(radius);
    },
    radius: 0,
    getArea: function() {
      return PI * Math.pow(this.radius, 2);
    }
  });
  
  var Rectangle = Shape.extend({
    constructor: function(x, y, width, height) {
      this.base(x, y);
      this.width = Number(width);
      this.height = Number(height);
    },
    width: 0,
    height: 0,
    getArea: function() {
      return this.width * this.height;
    }
  });
  
  // evaluate the exported namespace (this initialises the Package)
  eval(this.exports);
};

new function(_) { // create the closure
  // create the package object
  var graphics = new base2.Package(this, {
    name:    "graphics",
    version: "1.0",
    imports: "shapes",
    exports: "Layout"
  });
  
  // evaluate the imported namespace
  eval(this.imports);
  
  // we can refer to the Rectangle class directly because we have imported the
  // shapes Package.
  var Layout = Rectangle.extend({
    // I don't know anything about graphics
  });
  
  // evaluate the exported namespace (this initialises the Package)
  eval(this.exports);
};
Although the code assist is never got, this sample code in my test.html is running very right.
I think whether the cause is Spket can not support closure in nower version? I noticed someone have post a topic about it but no any answer for it.

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Re: Using base2.js but no code assist

Post by eric_suen » Tue Apr 27, 2010 6:50 pm

It does not support base2 library.

joe
Posts: 4
Joined: Mon Apr 26, 2010 3:36 pm

Re: Using base2.js but no code assist

Post by joe » Sat May 01, 2010 7:24 am

Thank u. I have give up using base2.js library.

Exception e
Posts: 18
Joined: Tue Aug 05, 2008 12:40 pm

Re: Using base2.js but no code assist

Post by Exception e » Fri May 07, 2010 7:23 pm

joe wrote:Thank u. I have give up using base2.js library.
You could also add the documentation by your self perhaps? Ok, you've given up, but it would be possible I think.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests