Created
August 7, 2015 03:57
-
-
Save abhibeckert/66f95f885f11ace75a01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "COTarget.h" | |
@implementation COTarget | |
+ (instancetype)targetWithAction:(MOJavaScriptObject *)action | |
{ | |
return [[[self class] alloc] initWithAction:action]; | |
} | |
- (instancetype)initWithAction:(MOJavaScriptObject *)action | |
{ | |
if (!(self = [super init])) | |
return nil; | |
self.action = action; | |
return self; | |
} | |
- (void)callAction:(id)sender | |
{ | |
JSObjectRef actionRef = [self.action JSObject]; | |
COScript *script = [COScript currentCOScript]; | |
[script callJSFunction:actionRef withArgumentsInArray:@[sender]]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment