From: Richard Huang Date: Thu, 10 Dec 2015 17:05:52 +0000 (+0000) Subject: Changed JavaScript API name for signal connection and disconnection X-Git-Tag: dali_1.1.15~13 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=ed63bc786cfe75f3ea8731ffa0d5d92d87a0131c Changed JavaScript API name for signal connection and disconnection Originally the code for signal connection and disconnection is: actor.connect("touched", onTouched); actor.disconnect("touched", onTouched); It needs to be changed to match the style of Node.JS event handling API and Tizen Native JavaScript API: actor.on("touched", onTouched); actor.off("touched", onTouched); Change-Id: I7d90651e6014b795292d696c90cb0ab77531a165 --- diff --git a/plugins/dali-script-v8/docs/content/actor.js b/plugins/dali-script-v8/docs/content/actor.js index 9f051fb..98b35a4 100644 --- a/plugins/dali-script-v8/docs/content/actor.js +++ b/plugins/dali-script-v8/docs/content/actor.js @@ -124,7 +124,7 @@ function OnPressed( actor, touchEvent ) } // connect to touch events -myActor.connect( "touched", onPressed ); +myActor.on( "touched", onPressed ); ``` @@ -143,7 +143,7 @@ hoverEvent = { } ``` // connect to touch events - myActor.connect( "hovered", onHover); + myActor.on( "hovered", onHover); #### Mouse wheel event @@ -161,7 +161,7 @@ mouseWheelEvent = { } // connect to touch events -myActor.connect( "mouseWheelEvent", onMouseWheel ); +myActor.on( "mouseWheelEvent", onMouseWheel ); ``` #### Key events diff --git a/plugins/dali-script-v8/docs/content/animation.js b/plugins/dali-script-v8/docs/content/animation.js index 9d4dd48..54ba7c3 100644 --- a/plugins/dali-script-v8/docs/content/animation.js +++ b/plugins/dali-script-v8/docs/content/animation.js @@ -35,7 +35,7 @@ function finished( animation ) log("Animation finished \n"); } -anim.connect("finished", finished ); +anim.on("finished", finished ); anim.play(); ``` diff --git a/plugins/dali-script-v8/docs/content/keyboard-focus-manager.js b/plugins/dali-script-v8/docs/content/keyboard-focus-manager.js index 821b5dd..fbdf726 100644 --- a/plugins/dali-script-v8/docs/content/keyboard-focus-manager.js +++ b/plugins/dali-script-v8/docs/content/keyboard-focus-manager.js @@ -18,7 +18,7 @@ The application is required to help the manager when moving focus. Connect to the pre-focus-change call back as follows: ``` // listen for pre-focus change events -dali.keyboardFocusManager.connect("keyboardPreFocusChange", this.preFocusChanged); +dali.keyboardFocusManager.on("keyboardPreFocusChange", this.preFocusChanged); // example call back handler @@ -39,7 +39,7 @@ myApp.preFocusChanged = function( currentFocusedActor, proposedActorToFocus, dir } } -dali.keyboardFocusManager.connect("keyboardPreFocusChange", myCallback) +dali.keyboardFocusManager.on("keyboardPreFocusChange", myCallback) ``` KeyboardFocusManager makes the best guess for which actor to focus towards the given direction, but applications might want to change that. @@ -58,7 +58,7 @@ myCallback( originalFocusedActor, currentFocusedActor) { } -dali.keyboardFocusManager.connect("keyboardFocusChange", myCallback) +dali.keyboardFocusManager.on("keyboardFocusChange", myCallback) ``` @class KeyboardFocusManager diff --git a/plugins/dali-script-v8/docs/content/pan-gesture-detector.js b/plugins/dali-script-v8/docs/content/pan-gesture-detector.js index 1e82183..55291e0 100644 --- a/plugins/dali-script-v8/docs/content/pan-gesture-detector.js +++ b/plugins/dali-script-v8/docs/content/pan-gesture-detector.js @@ -20,7 +20,7 @@ dali.stage.add(actor); panGestureDetector.attach(actor); // Connect the detected signal -panGestureDetector.connect("panDetected", onPan); +panGestureDetector.on("panDetected", onPan); onPan = function(actor, panGesture) { diff --git a/plugins/dali-script-v8/docs/content/resource-image.js b/plugins/dali-script-v8/docs/content/resource-image.js index e14ad0f..fb982a0 100644 --- a/plugins/dali-script-v8/docs/content/resource-image.js +++ b/plugins/dali-script-v8/docs/content/resource-image.js @@ -28,7 +28,7 @@ function imageLoaded( image ) var image = new dali.ResourceImage( {url: "my_image.png"} ); -image.connect("imageLoadingFinished", finished ); +image.on("imageLoadingFinished", finished ); // Create a material and add the image as texture to be used by the material. var material = new dali.Material(); diff --git a/plugins/dali-script-v8/docs/content/stage.js b/plugins/dali-script-v8/docs/content/stage.js index c8b4cf3..512b661 100644 --- a/plugins/dali-script-v8/docs/content/stage.js +++ b/plugins/dali-script-v8/docs/content/stage.js @@ -48,7 +48,7 @@ daliApp.myCallback = function (keyEvent) } } -dali.stage.connect("keyEvent", daliApp.myCallback); +dali.stage.on("keyEvent", daliApp.myCallback); ``` The key event object has the following properties diff --git a/plugins/dali-script-v8/src/shared/object-template-helper.cpp b/plugins/dali-script-v8/src/shared/object-template-helper.cpp index 3510523..34a97e4 100644 --- a/plugins/dali-script-v8/src/shared/object-template-helper.cpp +++ b/plugins/dali-script-v8/src/shared/object-template-helper.cpp @@ -34,12 +34,12 @@ namespace ObjectTemplateHelper void AddSignalConnectAndDisconnect( v8::Isolate* isolate, v8::Local& objTemplate ) { - objTemplate->Set( v8::String::NewFromUtf8( isolate, "connect"), + objTemplate->Set( v8::String::NewFromUtf8( isolate, "on"), v8::FunctionTemplate::New( isolate, SignalManager::SignalConnect) ); - objTemplate->Set( v8::String::NewFromUtf8( isolate, "disconnect"), + objTemplate->Set( v8::String::NewFromUtf8( isolate, "off"), v8::FunctionTemplate::New( isolate, SignalManager::SignalDisconnect) ); }