Created
May 9, 2010 19:04
-
-
Save Sakurina/395342 to your computer and use it in GitHub Desktop.
CaptainHook-inspired syntax sugar for hooking stuff with Cycript
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
/* | |
* fairchild - an enhanced syntax for hooking stuff with Cycript | |
* by Yanik Magnan - http://r-ch.net | |
*/ | |
var FCSuper = {}; | |
var FCClassSuper = {}; | |
function FCMethod(_className, _selector, _block) { | |
if (!FCSuper[_className]) | |
FCSuper[_className] = {}; | |
var _class = objc_getClass(_className); | |
FCSuper[_className][_selector] = _class.messages[_selector]; | |
_class.messages[_selector] = _block; | |
} | |
function FCClassMethod(_className, _selector, _block) { | |
if (!FCClassSuper[_className]) | |
FCClassSuper[_className] = {}; | |
var _class = objc_getClass(_className); | |
FCClassSuper[_className][_selector] = _class->isa.messages[_selector]; | |
_class->isa.messages[_selector] = _block; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment