Permalink
Browse files

Documentation, documentation, documentation and some cosmetics

  • Loading branch information...
1 parent 8822a73 commit b3745f235a7aba6973d39a77990bb0f6eb02a413 @phoboslab committed Sep 20, 2016
Showing with 615 additions and 146 deletions.
  1. +9 −9 Ejecta.xcodeproj/project.pbxproj
  2. +8 −0 Source/Ejecta/EJAppViewController.h
  3. +3 −0 Source/Ejecta/EJAudio/EJAudioSource.h
  4. +9 −0 Source/Ejecta/EJAudio/EJAudioSourceAVAudio.h
  5. +6 −0 Source/Ejecta/EJAudio/EJAudioSourceOpenAL.h
  6. +3 −0 Source/Ejecta/EJAudio/EJBindingAudio.h
  7. +4 −0 Source/Ejecta/EJAudio/EJOpenALBuffer.h
  8. +3 −0 Source/Ejecta/EJAudio/EJSharedOpenALManager.h
  9. +51 −23 Source/Ejecta/EJBindingBase.h
  10. +0 −18 Source/Ejecta/EJBindingEjectaCore.h
  11. +15 −1 Source/Ejecta/EJBindingEventedBase.h
  12. +35 −0 Source/Ejecta/EJBindingGlobalUtils.h
  13. +2 −2 Source/Ejecta/{EJBindingEjectaCore.m → EJBindingGlobalUtils.m}
  14. +7 −0 Source/Ejecta/EJBindingVideo.h
  15. +3 −0 Source/Ejecta/EJCanvas/2D/EJBindingCanvasContext2D.h
  16. +16 −16 Source/Ejecta/EJCanvas/2D/EJBindingCanvasContext2D.m
  17. +4 −0 Source/Ejecta/EJCanvas/2D/EJBindingCanvasGradient.h
  18. +4 −0 Source/Ejecta/EJCanvas/2D/EJBindingCanvasPattern.h
  19. +8 −0 Source/Ejecta/EJCanvas/2D/EJBindingImageData.h
  20. +3 −0 Source/Ejecta/EJCanvas/2D/EJBindingTextMetrics.h
  21. +4 −0 Source/Ejecta/EJCanvas/2D/EJCanvas2DTypes.h
  22. +13 −0 Source/Ejecta/EJCanvas/2D/EJCanvasContext2D.h
  23. +15 −15 Source/Ejecta/EJCanvas/2D/EJCanvasContext2D.m
  24. +2 −0 Source/Ejecta/EJCanvas/2D/EJCanvasContext2DScreen.h
  25. +2 −0 Source/Ejecta/EJCanvas/2D/EJCanvasContext2DTexture.h
  26. +10 −0 Source/Ejecta/EJCanvas/2D/EJCanvasGradient.h
  27. +3 −0 Source/Ejecta/EJCanvas/2D/EJCanvasPattern.h
  28. +6 −0 Source/Ejecta/EJCanvas/2D/EJCanvasShaders.h
  29. +11 −1 Source/Ejecta/EJCanvas/2D/EJConvertColorRGBA.h
  30. +17 −0 Source/Ejecta/EJCanvas/2D/EJFont.h
  31. +4 −4 Source/Ejecta/EJCanvas/2D/EJFontCache.h
  32. +3 −0 Source/Ejecta/EJCanvas/2D/EJGLProgram2D.h
  33. +3 −0 Source/Ejecta/EJCanvas/2D/EJGLProgram2DRadialGradient.h
  34. +3 −0 Source/Ejecta/EJCanvas/2D/EJImageData.h
  35. +14 −0 Source/Ejecta/EJCanvas/2D/EJPath.h
  36. +3 −0 Source/Ejecta/EJCanvas/EAGLView.h
  37. +7 −0 Source/Ejecta/EJCanvas/EJBindingCanvas.h
  38. +3 −0 Source/Ejecta/EJCanvas/EJBindingCanvasStyle.h
  39. +4 −0 Source/Ejecta/EJCanvas/EJBindingImage.h
  40. +3 −0 Source/Ejecta/EJCanvas/EJCanvasContext.h
  41. +4 −0 Source/Ejecta/EJCanvas/EJDrawable.h
  42. +3 −0 Source/Ejecta/EJCanvas/EJPresentable.h
  43. +10 −1 Source/Ejecta/EJCanvas/EJSharedTextureCache.h
  44. +21 −0 Source/Ejecta/EJCanvas/EJTexture.h
  45. +7 −0 Source/Ejecta/EJCanvas/EJTextureStorage.h
  46. +11 −0 Source/Ejecta/EJCanvas/WebGL/EJBindingCanvasContextWebGL.h
  47. +6 −0 Source/Ejecta/EJCanvas/WebGL/EJBindingWebGLExtensions.h
  48. +8 −0 Source/Ejecta/EJCanvas/WebGL/EJBindingWebGLObjects.h
  49. +3 −1 Source/Ejecta/EJCanvas/WebGL/EJBindingWebGLObjects.m
  50. +4 −0 Source/Ejecta/EJCanvas/WebGL/EJCanvasContextWebGL.h
  51. +2 −0 Source/Ejecta/EJCanvas/WebGL/EJCanvasContextWebGLScreen.h
  52. +2 −0 Source/Ejecta/EJCanvas/WebGL/EJCanvasContextWebGLTexture.h
  53. +4 −1 Source/Ejecta/EJCanvas/WebGL/EJConvertWebGL.h
  54. +18 −0 Source/Ejecta/EJClassLoader.h
  55. +19 −8 Source/Ejecta/EJConvert.h
  56. +11 −0 Source/Ejecta/EJJavaScriptView.h
  57. +16 −16 Source/Ejecta/EJJavaScriptView.m
  58. +13 −3 Source/Ejecta/EJNonRetainingProxy.h
  59. +19 −10 Source/Ejecta/EJSharedOpenGLContext.h
  60. +14 −14 Source/Ejecta/EJSharedOpenGLContext.m
  61. +11 −0 Source/Ejecta/EJTimer.h
  62. +3 −0 Source/Ejecta/EJUtils/EJBindingDeviceMotion.h
  63. +3 −0 Source/Ejecta/EJUtils/EJBindingGameCenter.h
  64. +7 −0 Source/Ejecta/EJUtils/EJBindingGeolocation.h
  65. +4 −0 Source/Ejecta/EJUtils/EJBindingHttpRequest.h
  66. +7 −0 Source/Ejecta/EJUtils/EJBindingImagePicker.h
  67. +7 −0 Source/Ejecta/EJUtils/EJBindingKeyInput.h
  68. +3 −1 Source/Ejecta/EJUtils/EJBindingLocalStorage.h
  69. +11 −0 Source/Ejecta/EJUtils/EJBindingTouchInput.h
  70. +5 −0 Source/Ejecta/EJUtils/EJBindingWebSocket.h
  71. +8 −0 Source/Ejecta/EJUtils/EJBindingWindowEvents.h
  72. +3 −0 Source/Ejecta/EJUtils/Gamepad/EJBindingGamepad.h
  73. +4 −0 Source/Ejecta/EJUtils/Gamepad/EJBindingGamepadButton.h
  74. +5 −0 Source/Ejecta/EJUtils/Gamepad/EJBindingGamepadProvider.h
  75. +6 −0 Source/Ejecta/EJUtils/IAP/EJBindingIAPManager.h
  76. +5 −0 Source/Ejecta/EJUtils/IAP/EJBindingIAPProduct.h
  77. +3 −0 Source/Ejecta/EJUtils/IAP/EJBindingIAPTransaction.h
  78. +2 −2 Source/Ejecta/Ejecta.js
@@ -40,7 +40,7 @@
B64CE666166682700087CF94 /* EJOpenALBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE61B166682700087CF94 /* EJOpenALBuffer.m */; };
B64CE667166682700087CF94 /* EJSharedOpenALManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE61D166682700087CF94 /* EJSharedOpenALManager.m */; };
B64CE668166682700087CF94 /* EJBindingBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE61F166682700087CF94 /* EJBindingBase.m */; };
- B64CE669166682700087CF94 /* EJBindingEjectaCore.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE621166682700087CF94 /* EJBindingEjectaCore.m */; };
+ B64CE669166682700087CF94 /* EJBindingGlobalUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE621166682700087CF94 /* EJBindingGlobalUtils.m */; };
B64CE66A166682700087CF94 /* EJBindingEventedBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE623166682700087CF94 /* EJBindingEventedBase.m */; };
B64CE66B166682700087CF94 /* EAGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE626166682700087CF94 /* EAGLView.m */; };
B64CE66D166682700087CF94 /* EJBindingImage.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE62A166682700087CF94 /* EJBindingImage.m */; };
@@ -118,7 +118,7 @@
B6F714981BCF126A0082A90F /* EJOpenALBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE61B166682700087CF94 /* EJOpenALBuffer.m */; };
B6F714991BCF126A0082A90F /* EJSharedOpenALManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE61D166682700087CF94 /* EJSharedOpenALManager.m */; };
B6F7149A1BCF126A0082A90F /* EJBindingBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE61F166682700087CF94 /* EJBindingBase.m */; };
- B6F7149B1BCF126A0082A90F /* EJBindingEjectaCore.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE621166682700087CF94 /* EJBindingEjectaCore.m */; };
+ B6F7149B1BCF126A0082A90F /* EJBindingGlobalUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE621166682700087CF94 /* EJBindingGlobalUtils.m */; };
B6F7149C1BCF126A0082A90F /* EJBindingEventedBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE623166682700087CF94 /* EJBindingEventedBase.m */; };
B6F7149D1BCF126A0082A90F /* EAGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE626166682700087CF94 /* EAGLView.m */; };
B6F7149E1BCF126A0082A90F /* EJBindingImage.m in Sources */ = {isa = PBXBuildFile; fileRef = B64CE62A166682700087CF94 /* EJBindingImage.m */; };
@@ -243,8 +243,8 @@
B64CE61D166682700087CF94 /* EJSharedOpenALManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EJSharedOpenALManager.m; sourceTree = "<group>"; };
B64CE61E166682700087CF94 /* EJBindingBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EJBindingBase.h; sourceTree = "<group>"; };
B64CE61F166682700087CF94 /* EJBindingBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EJBindingBase.m; sourceTree = "<group>"; };
- B64CE620166682700087CF94 /* EJBindingEjectaCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EJBindingEjectaCore.h; sourceTree = "<group>"; };
- B64CE621166682700087CF94 /* EJBindingEjectaCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EJBindingEjectaCore.m; sourceTree = "<group>"; };
+ B64CE620166682700087CF94 /* EJBindingGlobalUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EJBindingGlobalUtils.h; sourceTree = "<group>"; };
+ B64CE621166682700087CF94 /* EJBindingGlobalUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EJBindingGlobalUtils.m; sourceTree = "<group>"; };
B64CE622166682700087CF94 /* EJBindingEventedBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EJBindingEventedBase.h; sourceTree = "<group>"; };
B64CE623166682700087CF94 /* EJBindingEventedBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EJBindingEventedBase.m; sourceTree = "<group>"; };
B64CE625166682700087CF94 /* EAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EAGLView.h; sourceTree = "<group>"; };
@@ -517,8 +517,8 @@
B64CE61F166682700087CF94 /* EJBindingBase.m */,
B64CE622166682700087CF94 /* EJBindingEventedBase.h */,
B64CE623166682700087CF94 /* EJBindingEventedBase.m */,
- B64CE620166682700087CF94 /* EJBindingEjectaCore.h */,
- B64CE621166682700087CF94 /* EJBindingEjectaCore.m */,
+ B64CE620166682700087CF94 /* EJBindingGlobalUtils.h */,
+ B64CE621166682700087CF94 /* EJBindingGlobalUtils.m */,
B6E314E31BC7D1BF00D024C3 /* EJBindingVideo.h */,
B6E314E41BC7D1BF00D024C3 /* EJBindingVideo.m */,
B64CE63D166682700087CF94 /* EJConvert.h */,
@@ -536,8 +536,8 @@
isa = PBXGroup;
children = (
B64CE618166682700087CF94 /* EJBindingAudio.h */,
- B64CE613166682700087CF94 /* EJAudioSource.h */,
B64CE619166682700087CF94 /* EJBindingAudio.m */,
+ B64CE613166682700087CF94 /* EJAudioSource.h */,
B64CE614166682700087CF94 /* EJAudioSourceAVAudio.h */,
B64CE615166682700087CF94 /* EJAudioSourceAVAudio.m */,
B64CE616166682700087CF94 /* EJAudioSourceOpenAL.h */,
@@ -832,7 +832,7 @@
B64CE667166682700087CF94 /* EJSharedOpenALManager.m in Sources */,
B6B41FA21BF25A7F0075C00F /* EJBindingGamepadProvider.m in Sources */,
B64CE668166682700087CF94 /* EJBindingBase.m in Sources */,
- B64CE669166682700087CF94 /* EJBindingEjectaCore.m in Sources */,
+ B64CE669166682700087CF94 /* EJBindingGlobalUtils.m in Sources */,
B64CE66A166682700087CF94 /* EJBindingEventedBase.m in Sources */,
B64CE66B166682700087CF94 /* EAGLView.m in Sources */,
B64CE66D166682700087CF94 /* EJBindingImage.m in Sources */,
@@ -906,7 +906,7 @@
B6F714991BCF126A0082A90F /* EJSharedOpenALManager.m in Sources */,
B6B41FA31BF25A7F0075C00F /* EJBindingGamepadProvider.m in Sources */,
B6F7149A1BCF126A0082A90F /* EJBindingBase.m in Sources */,
- B6F7149B1BCF126A0082A90F /* EJBindingEjectaCore.m in Sources */,
+ B6F7149B1BCF126A0082A90F /* EJBindingGlobalUtils.m in Sources */,
B6F7149C1BCF126A0082A90F /* EJBindingEventedBase.m in Sources */,
B6F7149D1BCF126A0082A90F /* EAGLView.m in Sources */,
B6F7149E1BCF126A0082A90F /* EJBindingImage.m in Sources */,
@@ -1,3 +1,11 @@
+// Well, this is actually the place where most of the stuff from the
+// EJJavaScriptView should happen, if we'd follow the Model-View-Controller
+// (MVC) methodology.
+
+// Since the EJJavaScriptView is so tightly coupled to the JS execution and run
+// loop, the View Controller here is mostly an empty shell that just
+// instantiates a EJJavaScriptView, but does little else.
+
#import <Foundation/Foundation.h>
@interface EJAppViewController : UIViewController {
@@ -1,3 +1,6 @@
+// The protocol that all Audio Source types have to conform with in order to
+// be used as the source for an EJBindingAudio element.
+
#import <UIKit/UIKit.h>
@protocol EJAudioSourceDelegate;
@@ -1,3 +1,12 @@
+// An Audio Source backed by the iOS native AVAudioPlayer. An instance of this
+// class can be used as the source of a EJBindingAudio element.
+
+// AVAudioPlayer supports streaming from a file, so that this type of source
+// does not need much memory. However, starting playback can have a bit of lag.
+
+// Typically, you want this type of Audio Source for music or background ambient
+// sounds, but not for sound effects that need tight timing.
+
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@@ -1,3 +1,9 @@
+// An Audio Source backed by OpenAL. Several instances of AudioSourceOpenAL
+// may share the same underlying OpenALBuffer instance.
+
+// OpenAL sources are loaded fully into memory but provide lower latency
+// and "rapid fire" playback in contrast to AVAudio sources.
+
#import <Foundation/Foundation.h>
#import <OpenAL/al.h>
@@ -1,3 +1,6 @@
+// This provides an <audio> element to JavaScript. Each instance has its own
+// AudioSource - either backed by AVAudio or OpenAL.
+
#import <Foundation/Foundation.h>
#import "EJBindingEventedBase.h"
@@ -1,3 +1,7 @@
+// An OpenAL audio buffer that may be used by several OpenAL Audio sources.
+// This class takes care of loading an audio file from disk and decoding it
+// into a memory buffer.
+
#import <Foundation/Foundation.h>
#import <OpenAL/al.h>
@@ -1,3 +1,6 @@
+// The OpenALManager keeps track of the global OpenAL context and holds a
+// dictionary of all active buffers.
+
#import <Foundation/Foundation.h>
#import <OpenAL/al.h>
@@ -1,28 +1,45 @@
+// This is where the magic happens. EJBindingBase is the Base class for all
+// native Obj-C classes that expose functions and properties to JavaScript.
+
+// A subclass of EJBindingBase whose name begins with "EJBinding" is
+// automatically exposed to JavaScript at the global "Ejecta" object. E.g. the
+// class "EJBindingFoo" can be instantiated in JavaScript with:
+// var foo = new Ejecta.Foo();
+
+// This header provides some nasty C-macros that let you easily expose functions
+// and properties of your class.
+
+// The class itself just provide a reference to the JavaScript "jsObject" of the
+// instance, a reference to the EJJavaScriptView where this instance was created
+// and constructor and destructor functions.
+
#import <Foundation/Foundation.h>
#import "EJAppViewController.h"
#import "EJJavaScriptView.h"
#include <objc/message.h>
+
// (Not sure if clever hack or really stupid...)
-// All classes derived from this EJBindingBase will return a JSClassRef through the
-// 'getJSClass' class method. The properties and functions that are exposed to
-// JavaScript are defined through the 'staticFunctions' and 'staticValues' in this
-// JSClassRef.
+// All classes derived from this EJBindingBase will return a JSClassRef through
+// the 'getJSClass' class method. The properties and functions that are exposed
+// to JavaScript are defined through the 'staticFunctions' and 'staticValues' in
+// this JSClassRef.
-// Since these functions don't have extra data (e.g. a void*), we have to define a
-// C callback function for each js function, for each js getter and for each js setter.
+// Since these functions don't have extra data (e.g. a void*), we have to define
+// a C callback function for each js function, for each js getter and for each
+// js setter.
-// Furthermore, a class method is added to the objc class to return the function pointer
-// to the particular C callback function - this way we can later inflect the objc class
-// and gather all function pointers.
+// Furthermore, a class method is added to the objc class to return the function
+// pointer to the particular C callback function - this way we can later inflect
+// the objc class and gather all function pointers.
#define EJ_BINDING_CLASS_PREFIX "EJBinding"
-// We need to cast objc_msgSend into the proper function types for bound functions
-// to ensure 64bit compatability
+// We need to cast objc_msgSend into the proper function types for bound
+// functions to ensure 64bit compatability
#define _EJ_CALL_BOUND_OBJC_FUNC(INSTANCE, NAME, CTX, ARGC, ARGV) \
((JSValueRef(*)(id, SEL, JSContextRef, size_t, const JSValueRef [])) \
@@ -44,7 +61,8 @@
}
-// ------------------------------------------------------------------------------------
+
+
// Function - use with EJ_BIND_FUNCTION( functionName, ctx, argc, argv ) { ... }
#define EJ_BIND_FUNCTION(NAME, CTX_NAME, ARGC_NAME, ARGV_NAME) \
@@ -68,7 +86,8 @@
- (JSValueRef)_func_##NAME:(JSContextRef)CTX_NAME argc:(size_t)ARGC_NAME argv:(const JSValueRef [])ARGV_NAME
-// ------------------------------------------------------------------------------------
+
+
// Getter - use with EJ_BIND_GET( propertyName, ctx ) { ... }
#define EJ_BIND_GET(NAME, CTX_NAME) \
@@ -89,7 +108,8 @@
- (JSValueRef)_get_##NAME:(JSContextRef)CTX_NAME
-// ------------------------------------------------------------------------------------
+
+
// Setter - use with EJ_BIND_SET( propertyName, ctx, value ) { ... }
#define EJ_BIND_SET(NAME, CTX_NAME, VALUE_NAME) \
@@ -113,7 +133,7 @@
-// ------------------------------------------------------------------------------------
+
// Shorthand to define a function that logs a "not implemented" warning
#define EJ_BIND_FUNCTION_NOT_IMPLEMENTED(NAME) \
@@ -136,7 +156,8 @@
__EJ_GET_POINTER_TO(_func_##NAME)
-// ------------------------------------------------------------------------------------
+
+
// Shorthand to bind enums with name tables - use with
// EJ_BIND_ENUM( name, target, "name1", "name2", ...) );
@@ -174,26 +195,29 @@ static inline bool JSStrIsEqualToStr( const JSChar *s1, const char *s2, size_t l
}
-// ------------------------------------------------------------------------------------
+
+
// Shorthand to bind const numbers and strings
#define EJ_BIND_CONST(NAME, VALUE) \
+ (NSObject *)_const_##NAME { \
return @(VALUE); \
}
+
// Commas can't be used directly in macro arguments
#define _EJ_COMMA() ,
#define _EJ_EMPTY()
#define _EJ_LITERAL(X) X _EJ_EMPTY
-// ------------------------------------------------------------------------------------
-// Expand a F(INDEX,ARG) macro for each argument, max 16 arguments - use with
+
+
+// Expand a F(INDEX, ARG) macro for each argument, max 16 arguments - use with
// EJ_MAP( F, arg1, arg2, ... );
-// An offset for the index as well as a joiner (a macro that is expanded between each
-// F() expansion) can be specified with
+// An offset for the index as well as a joiner (a macro that is expanded between
+// each F() expansion) can be specified with:
// EJ_MAP_EXT( OFFSET, JOINER, F, arg1, arg2 );
// Adopted from https://github.com/swansontec/map-macro
@@ -217,14 +241,16 @@ static inline bool JSStrIsEqualToStr( const JSChar *s1, const char *s2, size_t l
#define _EJ_MAP1(IDX, JOINER, F, NAME, PEEK, ...) F(IDX, NAME) _EJ_MAP_NEXT(JOINER, PEEK, _EJ_MAP0) (IDX+1, JOINER, F, PEEK, __VA_ARGS__)
-// ------------------------------------------------------------------------------------
+
+
// EJ_ARGC(...) - get the argument count in a macro with __VA_ARGS__; max 16 args
#define EJ_ARGC(...) _EJ_ARGC_SEQ(__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1)
#define _EJ_ARGC_SEQ(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,n,...) n
-// ------------------------------------------------------------------------------------
+
+
// Unpack JavaScript values to numbers - use with
// EJ_UNPACK_ARGV(float value1, int value2, ...);
// or with an offset into argv
@@ -240,6 +266,8 @@ static inline bool JSStrIsEqualToStr( const JSChar *s1, const char *s2, size_t l
#define _EJ_UNPACK_NUMBER(INDEX, NAME) NAME = JSValueToNumberFast(ctx, argv[INDEX])
+
+
@class EJJavaScriptView;
@interface EJBindingBase : NSObject {
JSObjectRef jsObject;
@@ -1,18 +0,0 @@
-#import <Foundation/Foundation.h>
-#import "EJBindingEventedBase.h"
-#import "EJFont.h"
-
-typedef enum {
- kEJCoreAudioSessionAmbient,
- kEJCoreAudioSessionSoloAmbient,
- kEJCoreAudioSessionPlayback
-} EJCoreAudioSession;
-
-@interface EJBindingEjectaCore : EJBindingBase {
- NSString *deviceName;
- EJCoreAudioSession audioSession;
-}
-
-@property (readwrite, nonatomic) EJCoreAudioSession audioSession;
-
-@end
@@ -1,7 +1,18 @@
+// EJBindingEventedBase sits on top of EJBindingBase and provides some functions
+// for classes that want to implement events and host event listeners.
+
+// Events can be attached and removed from instances of this class from
+// JavaScript with the addEventListener() and removeEventListener() methods
+// or through `.onsomeevent = callback;` properties.
+
+// The EJBindingEvent class provides an implementation of an Event object
+// itself which will be passed to the callback.
+
#import "EJBindingBase.h"
-// ------------------------------------------------------------------------------------
+
+
// Events; shorthand for EJ_BIND_GET/SET - use with EJ_BIND_EVENT( eventname );
#define EJ_BIND_EVENT(NAME) \
@@ -30,6 +41,8 @@
__EJ_GET_POINTER_TO(_set_on##NAME)
+
+
typedef struct {
const char *name;
JSValueRef value;
@@ -49,6 +62,7 @@ typedef struct {
@end
+
@interface EJBindingEvent : EJBindingBase {
NSString *type;
JSObjectRef jsTarget;
@@ -0,0 +1,35 @@
+// EJBindingGlobalUtils hosts various functions and properties that are exposed
+// to JavaScript. An instance of this class is created by the Ejecta.js at
+// window.ejecta.
+
+// Some of the native functions in this class serve only as the "raw"
+// implementation and should not be called directly in JavaScript. E.g. the
+// log() function only accepts one argument and assumes it's a string. A small
+// shim in the Ejecta.js provides the usual console.log() semantics and calls
+// the native log() function internally.
+
+// Functionality includes: timers, intervals, userAgent properties, screen
+// properties (width, height, pixelRatio), orientation and onLine properties.
+// This class also provides the ejecta.include() function to load further
+// .js files.
+
+#import <Foundation/Foundation.h>
+#import "EJBindingEventedBase.h"
+#import "EJFont.h"
+#import "EJTimer.h"
+
+typedef enum {
+ kEJCoreAudioSessionAmbient,
+ kEJCoreAudioSessionSoloAmbient,
+ kEJCoreAudioSessionPlayback
+} EJCoreAudioSession;
+
+
+@interface EJBindingGlobalUtils : EJBindingBase {
+ NSString *deviceName;
+ EJCoreAudioSession audioSession;
+}
+
+@property (readwrite, nonatomic) EJCoreAudioSession audioSession;
+
+@end
Oops, something went wrong.

0 comments on commit b3745f2

Please sign in to comment.