Created
October 7, 2011 16:48
-
-
Save wlach/1270763 to your computer and use it in GitHub Desktop.
jsbridge test script
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
from __future__ import print_function | |
import jsbridge | |
import time | |
page_loaded_count = 0 | |
animation_finished_count = 0 | |
def page_loaded(obj): | |
global page_loaded_count | |
print("Page loaded (count %s)" % page_loaded_count) | |
page_loaded_count+=1 | |
def animation_finished(obj): | |
global animation_finished_count | |
print("Finished animation (count %s)" % animation_finished_count) | |
animation_finished_count += 1 | |
back_channel, bridge = jsbridge.wait_and_create_network("localhost", 24241) | |
back_channel.add_listener(page_loaded, eventType='EController.PageLoaded') | |
back_channel.add_listener(lambda obj: print("anim finished"), eventType='EController.AnimationFinished') | |
while 1: | |
back_channel.handle_read() | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment