I'm using the native Facebook Titanium module and I have the following issue.
In my app, you can login to FB from two different windows.
In the first one, I instatiated the module and added to the module a 'login' listener.
In the second window I did the same, I instantiated the module and added a 'login' listener.
Problem is the following: the second addEventListener doesn't overwrite the first (it looks like the second Facebook 'require' is simply a pointer to the module instantiated in the first window).
So, it happens the following: when I try to authorize the user and I enter the login listener, it turns out I'm always calling the first one, not the second (the second never gets called).
I tried to remove the first eventListener with no luck. Moreover, they 'live' in distant windows and it seems there's no way to remove this listener correctly.
Any help is appreciated,
Iannis
I hope this will clarify what you are seeing:
It's standard CommonJS behaviour that modules are cached and the second and following require() will get you a reference to the first instance.
Like the name says addEventListener adds an event listener and does not replace one added earlier.
You should get the login event twice, once for each event listener you add. I can't tell why it doesn't do that for you without further insight in your code.
Related
It's a bit of a specific scenario, and I seem to be missing a single detail I just can't get right.
Here's the deal:
I have an iOS app to which I've added a flutter module. All works well, integration's fine. Great.
I now have a specific need to embed a native view inside the flutter view. So, logically, I follow this: https://docs.flutter.dev/development/platform-integration/platform-views?tab=ios-platform-views-swift-tab .
I got everything, the UIKitView on the dart side, the factory and the platform view on the native side.
The only thing left is to actually register the factory and all should be well.
This is where I get stuck, I can't get the registrar because it requires a plugin name!
Docs say:
self.registrar(forPlugin: "<plugin-name>")!.register(
factory,
withId: "<platform-view-type>")
But, <plugin-name> is not defined anywhere. Tried the module's name, tried the main class in it, tried Flutter, tried App, tried FlutterPluginRegistrant, tried AppFramework... all desperate attempts, but I'm out of ideas.
Any help / hint would be greatly appreciated.
I'm using DTM to implement Adobe Analytics code on a single page app.
I have a link that we've set up successfully as an exit link and it fires as it should. If this matters, it opens in a new tab and we don't actually exit the website. However, any time we fire off any subsequent page views, we see the same event fired. Is there any way to fire off this event only when the link actually is clicked? I assume that because it's a one page app and the code isn't getting refreshed that is the reason it's on every subsequent page.
Using Adobe Analytics and DTM is frustrating with single page apps. What we do is clear all the variables that are set before each page view. We have a function that clears, props, evars, events, listVars, heir, pageName etc.
Please check witch version of s_code you are using, if you are using Appmeasurement or one of the last s_code versions please use clearkVars() function.
following code is a log from browser console with console responses:
s.events ="event1"
"event1"
s.linkTrackVars='events';
"events"
s.eVar1="value"
"value"
s.clearVars();
undefined
s.events
undefined
s.eVar1
undefined
you can fire this in custom code section (if your custom code section is set to fire after gui settings, or you can fire it as JavaScript 3rd party tag.
I have been working with icefaces since its version 1.8 and now I am getting into the latest version (3.0). I think my problem is not version related, but the solution could be.
I am programming an application which uses ICEpush. The model is like this:
Several devices are connected to the server via java.net.socket and running in an independent thread and every message could trigger an ajax push event.
When I use PushRenderer.Render("group") I get this:
java.lang.RuntimeException: FacesContext is not present for thread Thread[172.17.1.49,5,main].
When I use SessionRenderer.Render("group") it works as expected when I go the main page of the devices and I can see how the information changes on real time for everyone. The problem I find is that when I try to navigate to another view in my application I see that it is done in a very slow way and the buttons after I click on them do not work.
When I refresh the page they start working again until I navigate to the page of the devices where I get the problem again.
I have tried with the PortableRenderer but if I use PushRenderer.getPortableRenderer() I get a nullPointerException; and, if try to use PushRenderer.getPortableRenderer(FacesContext.getCurrentInstance()) I find that this method has changed its parameter to ServletContext that I do not know where I can find it.
I hope you can help me with this.
thanks in advance.
You can get the ServletContext from your FacesContext, like this:
ServletContext servletContext = (ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext();
Call PushRenderer.getPortableRenderer() from within the faces context. For example in the constructor of a managed bean. The portable renderer can than be passed to another thread and called later outside the faces context.
Has something changed in Firefox 6 so I can no longer add my nsIProtocolHandler (and nsIChannel) implementation from an add-on just by registering it under a contract like #mozilla.org/network/protocol;1?name=myscheme?
I've checked all the interfaces I use if any changed (judging by a new
UUID), but I don't get a call to my getFactoryProc I list in NSModule,
like I did before.
Do I need to add a category (like http-startup or something?) or is
something else wrong?
(the code that worked in firefox 3.6 is still here I haven't committed
the new code yet...)
Update: I've logged this as a bug.
Update: Okay, I figured this out. See https://bugzilla.mozilla.org/show_bug.cgi?id=656331. Basically you need to export the right kVersion value in your module or the library will be unloaded immediately after it is loaded (i.e. the behavior you are observing). This behavior is new as of Firefox 5.
If you haven't updated to Firefox 4 yet then you need to change the way that you register your XPCOM component. See https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0. The sections on JS components or binary components are relevant depending on whether your component is implemented in JS or C++.
I couldn't find it anywhere on Mozilla's documentation. Suppose I code an extension that uses addEventListener on keypress. What is the execution priority if a webpage contains a JS code that calls addEventListener on keypress (or keydown) too? Is it guaranteed that my extension receives the event first?
The event first goes through a "capturing" phase, then a "bubbling" phase. If you use the capturing phase (by putting true as the last parameter to addEventListener) then your listener will get called before the one on the page, if the one on the page uses the bubbling phase. I guess if you don't know which way it works on the page, then you could just attach it to something out of reach of the page (like the browser object, or even gBrowser) and then you would be sure that yours goes first. See http://www.w3.org/TR/DOM-Level-3-Events/#event-flow