Advanced JavaScript event framework