Wrappers-JQuery.st 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Smalltalk createPackage: 'Wrappers-JQuery'!
  2. (Smalltalk packageAt: 'Wrappers-JQuery' ifAbsent: [ self error: 'Package not created: Wrappers-JQuery' ]) imports: {'jQuery' -> 'jquery'}!
  3. Object subclass: #JQuery
  4. instanceVariableNames: ''
  5. package: 'Wrappers-JQuery'!
  6. !JQuery class methodsFor: 'initialization'!
  7. current
  8. ^ jQuery
  9. !
  10. initialize
  11. "Allow JS method calls for the jQuery object.
  12. See boot.js DNU handling."
  13. Smalltalk optOut: jQuery
  14. ! !
  15. !BlockClosure methodsFor: '*Wrappers-JQuery'!
  16. asJQuery
  17. ^ {self} asJQuery
  18. !
  19. asJQueryInContext: aContext
  20. ^ {self} asJQueryInContext: aContext
  21. ! !
  22. !JSObjectProxy methodsFor: '*Wrappers-JQuery'!
  23. asJQuery
  24. <inlineJS: 'return jQuery($self[''@jsObject''])'>
  25. !
  26. asJQueryInContext: aContext
  27. <inlineJS: 'return jQuery($self[''@jsObject''], aContext)'>
  28. ! !
  29. !Object methodsFor: '*Wrappers-JQuery'!
  30. asJQuery
  31. <inlineJS: 'return jQuery(self)'>
  32. !
  33. asJQueryInContext: aContext
  34. <inlineJS: 'return jQuery(self, aContext)'>
  35. ! !
  36. !String methodsFor: '*Wrappers-JQuery'!
  37. asJQuery
  38. <inlineJS: 'return jQuery(String(self))'>
  39. !
  40. asJQueryInContext: aContext
  41. <inlineJS: 'return jQuery(String(self), aContext)'>
  42. ! !