Jump to content

About loaders, can I set different query strings for each spritesheet to be load?


Recommended Posts

I have done similar solution with code like this:

 

function beforeSheetLoad(r,next){
  if(r.name.indexOf("json_image") >= 0 && r.url.indexOf("?") == -1)
  {
    r.url += "?" + something;
  }
  else if(r.name.indexOf(".json") >= 0 && r.url.indexOf("?") == -1)
  {
    r.url += "?" + something;
  }
  next();
}

loader = new Loader();
loader.pre(beforeSheetLoad);

 

Link to post
Share on other sites

I prefer hack it in already built pixijs, but I am not so familiar with hacking.
It uses some imported file in the function, how can  I deal with it? any instruction would be grateful.
 

import { Resource } from 'resource-loader';
import url from 'url';
import { Spritesheet } from '../core';
Link to post
Share on other sites

The correct way to implement this would be through a proposed "subresource options" feature (https://github.com/englercj/resource-loader/issues/98) and the addition of a Resource-specific option for appending a query string.

If you have better ideas for how this should work, please add them to: https://github.com/englercj/resource-loader/issues

As always PRs are welcome for additional features that make your life easier.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...