remove plugun instance - jquery-plugins

I am using jquery.timepickr.js. I want to be able to change the parameters, something like:
$('aField').timepickr( some default parameters);
User makes some choices:
$('aField').remove(timepickr);
$('aField').timepickr(some_other_parameters_reflecting_user_choices);
How can I destroy/unlink/remove/disassociate an instance of timepickr?
I have also tried $('aField').timepickr('destroy');

Their destroy function is not correctly cleaning up, as a work-around, try this:
$('aField').timepickr('destroy').next(".ui-timepickr").remove(); //Blow it away
$('aField').timepicker(); //Bring it back, new options
Only change is we're cleaning up the elements it creates after destroying the widget itself.

Related

Animation played once godot

I want to play a little Animated Sprite once, I mean only when the scene is visited the first time. I am trying to connect some signals in those ways:
on_scene_ready():
Animated_sprite.play("animation_name")
on_Animated_sprite_animation_finished():
Animated_sprite.hide()
And that's working correctly. But it repeats every time the scene is entered.
I tried a solution found on another forum that seemed to me similar to my issue: put a global variable (but doesn't work and I bet I make it bad)
var has_not_played = true
on_scene_ready():
if has_not_played:
Animated_sprite.play(animation_name)
on_Animated_sprite_animation_finished():
Animated_sprite.hide()
has_not_played = false
Any suggestions?
Thanks.
As long as you create a new instance of the scene (what you most likely do, as we can see) your has_not_played variable will always be instanced as true as well. Setting it to false will not help here then.
One simple solution would be to create a autoload script to hold all level informations you need your programm to save, after the scene was exited.
These are infos you most likely want to save as well, when your game is saved.
As an example you could do something like this.
Create a script LevelInfos.gd. Mine looked like this:
extends Node
var level_infos : Dictionary = {
"level_1" : {
"start_animation_played" : false
}
}
Then add this to Project -> project settings -> Autoload with the NodeName LevelInfos.
Now you can reuse your existing code like this:
on_scene_ready():
if not LevelInfos.level_infos["level_1"]["start_animation_played"]:
Animated_sprite.play(animation_name)
on_Animated_sprite_animation_finished():
Animated_sprite.hide()
LevelInfos.level_infos["level_1"]["has_already_loaded"] = true
This should make it so it only gets played the first time the scene is visited, after you start the game.
Code wise I guess it would be better to make dedicated variables instead of using a dictionary, but it works as a example and could be easily saved as an JSON, if needed.

Obtaining / iterating through data in the laravel service container via app()

If I do dd(app()) within my app I can see data that is useful to me within the #resolved branch of the service container object that is returned to screen.
A really silly question though; what is the easiest way of iterating through that data ? I've tried things like app()->resolved which don't work.
Well $resolved array is protected for something, however you can use reflection to get it:
$rp = new \ReflectionProperty('\Illuminate\Foundation\Application', 'resolved');
$rp->setAccessible(true);
dd($rp->getValue(app()));

Override #ngrx/data, #ngrx/entity Actions, Reducer, Effects

I'm new to #ngrx/data and trying to understand how I can override the reducer & actions.
My current problem could be solved in other ways like adding an extra method, reducer & action but I would probably need this answer in the future.
The problem is that my delete call should just set the item to "hidden" in the store and not to delete it.
This is the set-up I'm using: https://stackblitz.com/edit/ngrx-data-tutorial

Removing dynamic template events in Meteor

So, we all know that you can add events post-render by calling Template.templateName.events() and passing in new events. My question is: How do I remove them? I've found that I'm adding them how I like, but I end up with several of the same event, that all fire, and it's causing all sorts of problems. Is there a specific place that meteor stores the actual events? Where I could clear them out?
Template events should not be called several times but used once for static event definitions for this template that every instance of the template will listen to.
The documentation is not very helpful here. However, if you need dynamic template events you are still in good hands using the classic addEventListener or jQuery on and use bind to bind them to the template instance.
Don't forget to remove them when required but at least in Template#onDestroyed
I found that Template.templateName.__eventMaps = [] did the trick. I run this before creating a new instance of my template, and therefore only get one set of event handlers. woo!

Why I can't add a new variable to the Session in Classic ASP?

So, I thought that I could add a new element to the user Session to add some functionality.
I honestly thought I could do this:
SomeFunction(param1, NEWparam)
{
Session("MyNewParam") = NEWparam;
//So this would create a new session element called 'MyNewParam', right..?
...
}
That gets called when the user presses a button and then another webpage loads up.
The result, with this new line of code: The next web page doesn't load. Nothing happens.
Any and all comments are welcomed.
Solutions or helpful comments would be great.
Your syntax is right. However, I've run into an issue before where Classic ASP didn't want to take a session variable if it wasn't explicitly typed though. I'm not sure why this is, but it's worked for me in the past.
Session("MyNewParam") = parseInt(NEWparam);
Obviously, you could use String(), parseFloat()... or whatever. As I said, the syntax is right otherwise, so if the code isn't working you may want to start looking at other parts of the function that might be causing the problem.

Resources