[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
api[fb-web] index
| Note: this API is actually served by FB framework in U8. You can load the framework dynamically (from binary .st.js file) instead to fileIn this swiki page in your system. It is slower to fileIn. This page was used during development of the framework. |
You can evaluate the following expression to load(fileIn) the code in this page |
SwikiCodeRobot @> #apiFb-webIndex |
References
Code
#(FB AppEvents XFBML FBCanvas FBPrefetcher) do: [:each|
NativeObject subclass: each category: #FB
]!
FB class instanceVariableNames: #current!
! FB class methodsFor: #singleton !
current
" Returns the current instance of the receiver. "
current isNil ifTrue: [ current := self @ #{FB} ].
^current! !
FB buildFunctions: #(
#(init #(_params))
#(api #(path method _params callback))
#(api #(path method callback))
#(api #(path _params callback))
#(api #(path callback))
#(api #(path _params))
#(ui #(_params callback))
#(getLoginStatus #(callback))
login #(login #(callback)) #(login #(callback options))
logout #(logout #(callback))
getAccessToken #(#(accessToken getAccessToken)#())
getAuthResponse #(#(authResponse getAuthResponse)#())
getUserID #(#(userID getUserID)#())
)!
! FB class methodsFor: #events !
constructEventsTriggered
" Private - Return the events managed by instances of the receiver. "
^self fbEvents
,super constructEventsTriggered! !
! FB class methodsFor: #events !
fbEvents
" Private - Return the facebook events managed by instances of the receiver. "
^#(
'auth.login' 'auth.logout' 'auth.authResponseChange' 'auth.statusChange'
'comment.create' 'comment.remove'
'edge.create' 'edge.remove'
'message.send'
'xfbml.render'
)! !
! FB class methodsFor: #events !
selectorForEvent: anEvent
" Private - Return the selector to use to register binding to anEvent. "
(self fbEvents includes: anEvent) ifTrue: [
^anEvent ,$:
].
^nil! !
! FB methodsFor: #events !
bindEvent: eventSelector doing: closure
" Private - Bind the event handler. "
self subscribeEvent: (eventSelector upTo: $:) doing: closure! !
! FB methodsFor: #events !
subscribeEvent: eventSelector doing: closure
" Private - Bind the event handler. "
handle#Event
#subscribe: (eventSelector upTo: $:)
with: closure! !
! FB methodsFor: #events !
unsubscribeEvent: eventSelector doing: closure
" Private - Bind the event handler. "
handle#Event
#unsubscribe: (eventSelector upTo: $:)
with: closure! !
! FB methodsFor: #accessing !
appEvents
" Returns the appEvents of the receiver. "
^AppEvents @ (self handle basicAt: #AppEvents)! !
! FB methodsFor: #accessing !
xfbml
" Returns the XFBML of the receiver. "
^XFBML @ (self handle basicAt: #XFBML)! !
! FB methodsFor: #accessing !
canvas
" Returns the Canvas of the receiver. "
^FBCanvas @ (self handle basicAt: #Canvas)! !
! FB methodsFor: #accessing !
prefetcher
" Returns the Prefetcher of the receiver. "
^FBPrefetcher @ (self handle basicAt: #Prefetcher)! !
AppEvents buildFunctions: #(
#(logEvent #(eventName valueToSum _parameters))
#(logEvent #(eventName valueToSum))
#(logEvent #(eventName _parameters))
#(logEvent #(eventName))
#(logPurchase #(purchaseAmount currency _parameters))
#(logPurchase #(purchaseAmount currency))
activateApp logPageView
getUserID clearUserID
#(setUserID #(userID))
#(updateUserProperties #(_params callback))
#(setAppVersion #(appVersion))
getAppVersion clearAppVersion
)!
! AppEvents methodsFor: #accessing !
eventNames
" Returns the event names constants (aJS) of the receiver. "
^JS @ (self handle basicAt: #EventNames)! !
! AppEvents methodsFor: #accessing !
parameterNames
" Returns the parameter names constants (aJS) of the receiver. "
^JS @ (self handle basicAt: #ParameterNames)! !
! AppEvents methodsFor: #wrappers !
log: event value: value with: parameters
" Log the event. "
| pool |
parameters notNil ifTrue: [ | js names |
names := self parameterNames.
js := JS @ parameters json.
pool := PoolDictionary new.
js propertiesDo: [:key :value|
pool at: names @ key put: value
]
].
^self logEvent: self eventNames @ event
valueToSum: value json
parameters: pool ! !
! AppEvents methodsFor: #wrappers !
log: event value: value
" Log the event. "
^self log: event value: value with: nil! !
! AppEvents methodsFor: #wrappers !
log: event with: parameters
" Log the event. "
^self log: event value: nil with: parameters! !
! AppEvents methodsFor: #wrappers !
log: event
" Log the event. "
^self log: event value: nil with: nil! !
XFBML buildFunctions: #(
parse
#(parse #(_domElement callback))
#(parse #(_domElement))
)!
FBCanvas buildFunctions: #(
#(scrollTo #(x y))
setAutoGrow #(setAutoGrow #(value))
setSize #(setSize #(_params))
#(setUrlHandler #(url))
setDoneLoading #(setDoneLoading #(callback))
startTimer
stopTimer #(stopTimer #(callback))
)!
FBPrefetcher buildFunctions: #(
#(addStaticResource #(url))
#(setCollectionMode #(value))
)!
! FBPrefetcher methodsFor: #mode !
automatic
" Set the receiver to automatic mode. "
^self mode: #COLLECT_AUTOMATIC! !
! FBPrefetcher methodsFor: #mode !
manual
" Set the receiver to manual mode. "
^self mode: #COLLECT_MANUAL! !
! FBPrefetcher methodsFor: #mode !
mode: modeName
" Set the receiver to mode. "
^self setCollectionMode: (self handle basicAt: modeName)! !