0

While using the apple JavascriptCore reference for usage in my webkit c program everything works fine which is good.

The only problem is there doesn't seem to be any documentation on how to set c functions as instance methods. There is a way to set, or get the prototype, but I don't know what good it is because I can't figure out how to set methods on it.

If there's a way I can't find it. There is a way to set properties, but only with javascript values. There is a simple way to set c functions as static methods, but not c functions as instance methods as far as I can tell. Unless I'm misunderstanding the docs.

I have tried the webkit email help list, but no one is replying.

I think I have solved this. Turns out objects are also values for webkit JavascriptCore. This might seem obvious, but in the c api sometimes objects are not values. I'll be coming back to explain all this when I answer my own question.

Quentin Engles
  • 2,744
  • 1
  • 20
  • 33
  • What exactly do you mean by instance method? You want to do something like ‘this.some method=cMethod‘ why does every instance need it's own method? Normally a method/function would do the same for every instance so you can define it on the prototype: http://stackoverflow.com/questions/16063394/prototypical-inheritance-writing-up/16063711#16063711 – HMR Aug 03 '14 at 05:33
  • JavascriptCore from webkit can have c functions become objects. I want c functions to assign as methods. I can't just do that in javascript. – Quentin Engles Aug 03 '14 at 06:00
  • @HMR I guess I also mean methods that reference this, but are defined inside a c program. I'm using GTK. – Quentin Engles Aug 03 '14 at 06:04
  • @HMR Or maybe I can do that in javascript, but I won't be able to use c standard libraries, or any other c libraries for that matter. – Quentin Engles Aug 03 '14 at 06:10

0 Answers0