Listening to Transition Events

前端之家收集整理的这篇文章主要介绍了Listening to Transition Events前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Listening to Transition Events Authors: Yoshiroh KamiyamaThere are two ways to listen to varIoUs transition events,connect and pub/sub.Connect to Transition EventsThe View widget has five stub methods,onStartView,onBeforeTransitionIn,onAfterTransitionIn,onBeforeTransitionOut,and onAfterTransitionOut,to which you can connect.onStartViewSummaryA method that is called only when this view is shown at startup time. That is,if the view is invisible at startup time and then becomes visible as a result of a view transition,onStartView does NOT fire.SyntaxonStartView()Example// 'connect' is the return value of the module dojo/_base/connectconnect.connect(view1,"onStartView",null,function(){ console.log("startView: view="+this);});onBeforeTransitionInSummaryA method that is called immediately before a view transition that makes this view visible.SyntaxonBeforeTransitionIn(moveTo,dir,transition,context,method)moveTo - The destination view id to transition the current view to.dir - The transition direction. If 1,transition forward. If -1,transition backward.transition - The name of transition to perform. Ex. “slide”context - The object that the callback function will receive as “this”.method - A callback function that is called when the transition has finished.Example// 'connect' is the return value of the module dojo/_base/connectconnect.connect(view1,"onBeforeTransitionIn",function(moveTo,method){ print("onBeforeTransitionIn");});onAfterTransitionInSummaryA method that is called immediately after a view transition that makes this view visible.SyntaxonAfterTransitionIn(moveTo,"onAfterTransitionIn",method){ print("afterTransitionIn");});onBeforeTransitionOutSummaryA method that is called immediately before a view transition that makes this view hidden.SyntaxonBeforeTransitionOut(moveTo,"onBeforeTransitionOut",method){ print("onBeforeTransitionOut");});onAfterTransitionOutSummaryA method that is called immediately after a view transition that makes this view hidden.SyntaxonAfterTransitionOut(moveTo,"onAfterTransitionOut",method){ print("afterTransitionOut");});Subscribe Transition EventsThe View widget publishes five topics that are related to view transition./dojox/mobile/startViewSummaryA topic that is published only when this view is shown at startup time. That is,the view does NOT publish this topic.Topic Subscriberfunction(view)view - A view that initiated the view transition.Example// 'connect' is the return value of the module dojo/_base/connectconnect.subscribe("/dojox/mobile/startView",function(view){ console.log("startView: view="+view);});/dojox/mobile/beforeTransitionInSummaryA topic that is published immediately before a view transition that makes this view visible.Topic Subscriberfunction(view,moveTo,method)view - The destination viewmoveTo - The destination view id to transition the current view to.dir - The transition direction. If 1,transition backward.transition - The name of transition to perform. Ex. “slide”context - The object that the callback function will receive as “this”.method - A callback function that is called when the transition has finished.Example// 'connect' is the return value of the module dojo/_base/connectconnect.subscribe("/dojox/mobile/beforeTransitionIn",function(view,method){ print("onBeforeTransitionIn");});/dojox/mobile/afterTransitionInSummaryA topic that is published immediately after a view transition that makes this view visible.Topic Subscriberfunction(view,transition backward.transition - The name of transition to perform. Ex. “slide”context - The object that the callback function will receive as “this”.method - A callback function that is called when the transition has finished.Example// 'connect' is the return value of the module dojo/_base/connectconnect.subscribe("/dojox/mobile/afterTransitionIn",method){ print("afterTransitionIn");});/dojox/mobile/beforeTransitionOutSummaryA topic that is published immediately before a view transition that makes this view hidden.Topic Subscriberfunction(view,method)view - The start view. (A view that initiated the transition)moveTo - The destination view id to transition the current view to.dir - The transition direction. If 1,transition backward.transition - The name of transition to perform. Ex. “slide”context - The object that the callback function will receive as “this”.method - A callback function that is called when the transition has finished.Example// 'connect' is the return value of the module dojo/_base/connectconnect.subscribe("/dojox/mobile/beforeTransitionOut",method){ print("onBeforeTransitionOut");});/dojox/mobile/afterTransitionOutSummaryA topic that is published immediately after a view transition that makes this view hidden.Topic Subscriberfunction(view,transition backward.transition - The name of transition to perform. Ex. “slide”context - The object that the callback function will receive as “this”.method - A callback function that is called when the transition has finished.Exampledojo.subscribe("/dojox/mobile/afterTransitionOut",method){ print("afterTransitionOut");});Reference GuideDojo Version StartpageDojoDijitDojoXTable Of ContentsListening to Transition EventsConnect to Transition EventsonStartViewonBeforeTransitionInonAfterTransitionInonBeforeTransitionOutonAfterTransitionOutSubscribe Transition Events/dojox/mobile/startView/dojox/mobile/beforeTransitionIn/dojox/mobile/afterTransitionIn/dojox/mobile/beforeTransitionOut/dojox/mobile/afterTransitionOutPrevIoUs topicTemplating dojox/mobile widgetsNext topicdojox/mvcQuick search转自:http://dojotoolkit.org/reference-guide/1.9/dojox/mobile/transition-events.html#dojox-mobile-transition-events

原文链接:https://www.f2er.com/dojo/291394.html

猜你在找的Dojo相关文章