当前位置 : 主页 > 网页制作 > Dojo >

Listening to Transition Events

来源:互联网 收集:自由互联 发布时间:2021-06-15
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, on

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", null,   function(moveTo, dir, transition, context, method){       print("onBeforeTransitionIn");});onAfterTransitionInSummaryA method that is called immediately after a view transition that makes this view visible.SyntaxonAfterTransitionIn(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, "onAfterTransitionIn", null,   function(moveTo, dir, transition, context, method){      print("afterTransitionIn");});onBeforeTransitionOutSummaryA method that is called immediately before a view transition that makes this view hidden.SyntaxonBeforeTransitionOut(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, "onBeforeTransitionOut", null,   function(moveTo, dir, transition, context, method){      print("onBeforeTransitionOut");});onAfterTransitionOutSummaryA method that is called immediately after a view transition that makes this view hidden.SyntaxonAfterTransitionOut(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, "onAfterTransitionOut", null,   function(moveTo, dir, transition, context, 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, if the view is invisible at startup time and then becomes visible as a result of a view transition, 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, dir, transition, context, method)view - The destination viewmoveTo - 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.subscribe("/dojox/mobile/beforeTransitionIn",    function(view, moveTo, dir, transition, context, method){      print("onBeforeTransitionIn");});/dojox/mobile/afterTransitionInSummaryA topic that is published immediately after a view transition that makes this view visible.Topic Subscriberfunction(view, moveTo, dir, transition, context, method)view - The destination viewmoveTo - 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.subscribe("/dojox/mobile/afterTransitionIn",    function(view, moveTo, dir, transition, context, method){      print("afterTransitionIn");});/dojox/mobile/beforeTransitionOutSummaryA topic that is published immediately before a view transition that makes this view hidden.Topic Subscriberfunction(view, moveTo, dir, transition, context, 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 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.subscribe("/dojox/mobile/beforeTransitionOut",    function(view, moveTo, dir, transition, context, method){       print("onBeforeTransitionOut");});/dojox/mobile/afterTransitionOutSummaryA topic that is published immediately after a view transition that makes this view hidden.Topic Subscriberfunction(view, moveTo, dir, transition, context, 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 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.Exampledojo.subscribe("/dojox/mobile/afterTransitionOut",    function(view, moveTo, dir, transition, context, 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

上一篇:Dynamic Content Loading
下一篇:dojo Expando Pane
网友评论