This file contains hidden or 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
- (id)init { | |
self = [super initWithWindowNibName:@"FAMainApp"]; | |
if (self) { | |
bridge = [[FAMainAppJSBridge alloc] initWithApp:self]; | |
… | |
} | |
return self; | |
} |
This file contains hidden or 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
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)sel | |
{ | |
return NO; | |
} | |
+ (BOOL)isKeyExcludedFromWebScript:(const char *)name | |
{ | |
return NO; | |
} |
This file contains hidden or 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
@interface FAMainAppJSBridge : NSObject<NSURLDownloadDelegate> { | |
FAMainApp *app; | |
FAAddInbox *addInbox; | |
FAWebPopup *popup; | |
} | |
- (id)initWithApp:(FAMainApp *)app; | |
- (void)sendNotification:(NSString *)title message:(NSString *)message link:(NSString *)link; | |
- (void)openExternalURL:(NSString *)rawURL; | |
- (void)downloadFile:(NSString *)name atURL:(NSString *)rawUrl; |
This file contains hidden or 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
$window.jsapi = { | |
refresh: function () { | |
emitRootScope('refresh'); | |
}, | |
search: function (query) { | |
$rootScope.$apply(function () { | |
locations.search(query); | |
}); | |
}, |
This file contains hidden or 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
- (void)runJavaScript:(NSString *)command { | |
NSLog(@"js: %@", command); | |
[self.web stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"if (typeof jsapi !== 'undefined') %@;", command]]; | |
} | |
- (void)toggleArchived { | |
[self runJavaScript:@"jsapi.toggleArchiveConversation()"]; | |
} |
This file contains hidden or 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
defaults write com.yourcompany.YourApp WebKitDeveloperExtras -bool true |
This file contains hidden or 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
app.directive('faFastScroll', ['$parse', function ($parse) { | |
var Interval = function(min, max) { | |
this.min = min || 0; | |
this.max = max || 0; | |
}; | |
Interval.prototype.clip = function(min, max) { | |
if(this.max <= min || this.min >= max) { | |
this.min = this.max = 0; |
This file contains hidden or 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
frontApp.directive('fastScroll', ['$parse', function ($parse) { | |
var Interval = function(min, max) { | |
this.min = min || 0; | |
this.max = max || 0; | |
}; | |
Interval.prototype.clip = function(min, max) { | |
if(this.max <= min || this.min >= max) { | |
this.min = this.max = 0; |
This file contains hidden or 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
function findAvailablePort(app, done) { | |
var port = portrange; | |
portrange += 1; | |
var server = http.createServer(app); | |
server.listen(port, function (err) { | |
done(server, port); | |
}); |
This file contains hidden or 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
// a.js | |
var moduleB = require('./b'); | |
function ModuleA() { | |
} | |
ModuleA.hello = function () { | |
console.log('hello!'); | |
}; |