Re: Pengine url
Torbjörn Lager <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CA+Y3JZjHypxNg-DwU-YG+0=oUDkPMdcTQtMM+v-r4fh_o7b0iA@mail.gmail.com> |
Yes, that's a nice addition. But maybe we should consider keeping the
event handlers separate, by grouping them like this?:
var pengine = new Pengine({
handlers: {
oncreate: handleCreate,
onsuccess: handleSuccess,
onfailure: handleFailure,
onstop, handleStop
},
server: 'http://mygame.org',
src: ...
});
What do you think?
Cheers,
Torbjörn
On Sat, Feb 8, 2014 at 9:49 PM, Jan Wielemaker <[email protected]> wrote:
> On 02/08/2014 08:22 PM, Jan Wielemaker wrote:
>> On 02/08/2014 08:13 PM, Anne Ogborn wrote:
>>> If I rebase the server what happens with pengine connections?
>>
>> That is a problem. The pengines.pl library defines them at
>> root(pengines/create), etc. pengines.js hard-codes them at
>> /pengines/create, etc. Not really sure how to fix that. I
>> guess the closest we can get is by ensuring that <prefix>/js/pengines.js
>> produces a version that is compatible with the handers at the
>> server side.
>>
>> Just a tought: if you put a relative location in a script file,
>> does it resolve relative to the script or the page that has a
>> link loading the script?
>
> That clearly doesn't work :-( Fetching the URL of pengines.js is
> possible, but not so easily that it is a great idea. I've added
> a partial work-around by adding `server: string` to the Pengine
> configuration object. The pengine interaction is found at
>
> server + pengine/create (etc)
>
> If server is not given, it is "/". At least that allows hacking
> around this without modifying pengines.js. In addition, it allows
> copying pengines.js to any web server and using it for cross-site
> scripting, or chatting to different pengine servers from the same
> JavaScript script.
>
> Hope this helps to keep moving forwards ...
>
> Cheers --- Jan
--
Torbjörn Lager
Professor of General and Computational Linguistics
Department of Philosophy, Linguistics and Theory of Science
University of Gothenburg
Box 200, SE-405 30 Gothenburg, Sweden
Phone: +46317864962