Redefining default PackageTransport

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Redefining default PackageTransport

fstephany
I'm trying to override the AmdPackage transport with my own solution to replace the ajax call on the amber server to save packages.

I've dabbled a bit by extending "AmdPackageHandler" and overriding commitJsFileFor: and commitStFileFor:

I've also subclassed the AmdPackageTransport with my own class and redefined


!BlopPackageTransport class methodsFor: 'as yet unclassified'!

    type
        ^ 'blop'
! !

I'm trying to register this pacakge transport as the default but it doesn't seem to work:

require(['amber/helios', 'com_tamere_blop/Blop-Importer-Exporter'], function (smalltalk) {
          smalltalk.defaultAmdNamespace = "com_tamere_blop";
         smalltalk.PackageTransport._register_(smalltalk.BlopPackageTransport);
          smalltalk.defaultTransportType = "blop";
          smalltalk.initialize();
}

Is there something I missed there ?

Cheers,
Francois

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Redefining default PackageTransport

Herby Vojčík
Transport is for loading, not just for saving. Therefore, all packages have 'amd' transport type. Even if you manage to change the default, it will be used only for new packages (and even that may be not true, maybe creating new package is hardwired to amd and using defaultAmdNamespace, I'm not sure about the details).

If you manage to set transport type of the package, it will use it for committing.

Herby

François Stephany wrote:

> I'm trying to override the AmdPackage transport with my own solution
> to replace the ajax call on the amber server to save packages.
>
> I've dabbled a bit by extending "AmdPackageHandler" and overriding
> commitJsFileFor: and commitStFileFor:
>
> I've also subclassed the AmdPackageTransport with my own class and
> redefined
>
>
> !BlopPackageTransport class methodsFor: 'as yet unclassified'!
>
>     type
>         ^ 'blop'
> ! !
>
> I'm trying to register this pacakge transport as the default but it
> doesn't seem to work:
>
> require(['
amber/helios', 'com_tamere_blop/Blop-Importer-Exporter'],

> function (smalltalk) {
>           smalltalk.defaultAmdNamespace = "com_tamere_blop";
>          
> smalltalk.PackageTransport._register_(smalltalk.BlopPackageTransport);
>           smalltalk.defaultTransportType = "blop";
>           smalltalk.initialize();
> }
>
> Is there something I missed there ?
>
> Cheers,
> Francois

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.