Skip to content

Instantly share code, notes, and snippets.

@abhibeckert
Created August 7, 2015 03:57
Show Gist options
  • Save abhibeckert/66f95f885f11ace75a01 to your computer and use it in GitHub Desktop.
Save abhibeckert/66f95f885f11ace75a01 to your computer and use it in GitHub Desktop.
#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