Explorar el Código

More class comments

Nicolas Petton hace 13 años
padre
commit
f58d7240ab
Se han modificado 2 ficheros con 23 adiciones y 1 borrados
  1. 0 0
      js/Kernel-Objects.js
  2. 23 1
      st/Kernel-Objects.st

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
js/Kernel-Objects.js


+ 23 - 1
st/Kernel-Objects.st

@@ -21,7 +21,7 @@ Object has no instance variable.
 ##Access
 
 Instance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> instanceVariableNames` answers a collection of all instance variable names.
-Accessing JavaScript properties if an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.
+Accessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.
 
 ##Copying
 
@@ -1300,6 +1300,28 @@ x: aNumber y: anotherNumber
 Object subclass: #JSObjectProxy
 	instanceVariableNames: 'jsObject'
 	category: 'Kernel-Objects'!
+!JSObjectProxy commentStamp!
+JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.
+JSOjbectProxy makes intensive use of `#doesNotUnderstand:`.
+
+## Examples
+
+JSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.
+
+    window alert: 'hello world'.
+    window inspect.
+    (window jQuery: 'body') append: 'hello world'
+
+Smalltalk messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown. 
+
+## Message conversion rules
+
+- `someUser name` becomes  `someUser.name`
+- `someUser name: 'John'` becomes `someUser name = "John"`
+- `console log: 'hello world'` becomes `console.log('hello world')`
+- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`
+
+__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.!
 
 !JSObjectProxy methodsFor: 'accessing'!
 

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio