forked from doo/GAJavaScriptTracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGAJSWebViewEngine.h
More file actions
executable file
·54 lines (41 loc) · 1.41 KB
/
GAJSWebViewEngine.h
File metadata and controls
executable file
·54 lines (41 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// GAJSEngine.h
// GAJavaScriptTracker
//
// Created by Dominik Pich
// Copyright © 2012 doo GmbH / Dominik Pich. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <WebKit/WebKit.h>
@interface GAJSWebViewEngine : NSObject
//webview for base html and JS Context
@property(nonatomic, readonly) WebView *webView;
@property(nonatomic, strong) WebView *debugwebview;
//name of html -- which must reside in our bundle
@property(nonatomic, copy) NSString *htmlName;
//dictionary with content to insert into the html.
// the keys are strings that are in the original html file as %key%
// the content for each key should be html
@property(nonatomic, copy) NSDictionary *htmlVariables;
//the Javascript calls are batched when this is > 1
@property(nonatomic, assign) NSUInteger batchSize;
//the max interval for dispatching batches
@property(nonatomic) NSTimeInterval batchInterval;
//enqueues JavaScript to be executed when batch is full
- (void)runJS:(NSString *)aJSString;
//loads a JS file and executes it when batch is full
- (void)loadJSLibraryFromBundle:(NSString*)libraryName;
- (void)loadJSLibraryFromURL:(NSURL*)url;
//flushes all JS left
- (void)flushJS;
@end
//config of agent
#ifndef DEFAULT_BATCH_INTERVAL
#define DEFAULT_BATCH_INTERVAL 5.0f
#endif
#ifndef FREE_WEBVIEW_AFTER_BATCH
#define FREE_WEBVIEW_AFTER_BATCH 0
#endif
#ifndef DEBUG_WEBVIEW_ENGINE
#define DEBUG_WEBVIEW_ENGINE 1
#endif