How to make plugin domain specific?

For developers using the Construct 2 Javascript SDK

Post » Tue Feb 18, 2014 6:21 pm

I wrote a plugin that I've been using for my own purposes so far, and it's working fine, but there are still a few bugs/annoyances I want to fix before I release it to Construct's general plugin pool.

One of these bugs is that it breaks Construct in debug mode.

This is because the plugin requires the application to run in a specific domain (in this case Synaptop) to run any of the plugin's functionality, similar to Kongregate.

However, Kongregate's plugin and Facebook's plugin simply do not run in the Construct 2's debugger, my plugin actually breaks the debugger. (When exported and run in the wrong domain it simply doesn't run, similar to the other plugins, when exported and run on Synaptop, it works as it should.)
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Tue Feb 18, 2014 6:41 pm

It's probably just a mistake in your plugin. Nobody can help without more information about the error though.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,684

Post » Tue Feb 18, 2014 7:30 pm

And that's what I'm trying to fix, I can give more information.

The error is as follows:

Javascript error!
ReferenceError: synaptop is not defined
http://localhost:50000/Synaptop_plugin.js, line 67 (col undefined)

This is either a bug in Construct 2 or a problem in a third party plugin or behavior - please report it to the developer!

Line 67 of the run time file is where I call the actual code which loads the api.

Furthermore, the plugin requires a modification of the html header file exported by Construct 2 (it takes in and finds the app ID). It may well be not having this piece which causes the error during debugging.Robsta2014-02-18 19:31:17
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Tue Feb 18, 2014 7:35 pm

I guess what I'm looking for is if there's an easy way to turn off a plugin during debugging mode, as implemented on the side of the plugin developer.
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Wed Feb 19, 2014 1:19 am

when you load the api, check if synaptop is undefined. If it isn't, don't load it.EncryptedCow2014-02-19 01:20:05
B
46
S
14
G
7
Posts: 603
Reputation: 8,106


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests