{"id":"minstrix/fibre","name":"fibre","scope":"minstrix","platform":"roblox","description":"Deprecated, do not use.","version":"0.3.1","latest":"0.3.1","versions":["0.2.1","0.3.0","0.3.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":["The package archive does not include its license text; the license is declared in its manifest metadata."],"licenseVerified":false,"dependencies":{},"integrity":"b65f1b57cca31ba52f8ee446ed74c68b96b17843712faf092e9a49dcc7b71733","likes":0,"downloads":0,"install":"forest install minstrix/fibre","url":"https://forest.dev/p/roblox/minstrix/fibre","files":"https://api.forest.dev/ai/package/roblox/minstrix/fibre/files","readme":"# **Fibre**\nFibre is a Knit-inspired framework for server-client communication. If you've used [Knit](https://github.com/Sleitnick/Knit) before, you will notice many similarities and a few key differences - namely in how services are added/retrieved.\n\n**DISCLAIMER:** The following is *temporary* documentation. Proper docs will be produced once Fibre is in a more final state.\n\n## **Installation**\n---\nCurrently you can install Fibre by directly adding the source files into your [Rojo](https://github.com/rojo-rbx/rojo) project or by downloading the latest `.rbxm` in [releases](https://github.com/Minstrix/Fibre/releases). Wally is not currently supported but will be in the future.\n\n## **Usage Example**\n---\nIn a server script:\n```lua\nlocal ServerStorage = game:GetService(\"ServerStorage\")\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\n\nlocal Fibre = require(ReplicatedStorage.Fibre)\nFibre.AddChildren(ServerStorage.Services)\nFibre.Start(true)\n\nprint(Fibre.Server.Get(\"Capitalizer\"):AllCaps(\"server\")) --> \"SERVER\"\n```\n\nIn a module script named `Capitalizer` in `ServerStorage.Services`:\n```lua\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\nlocal Fibre = require(ReplicatedStorage.Fibre)\n\nlocal Capitalizer = {}\nCapitalizer.Client = {} -- for functions and RemoteSignals only!\n\nfunction Capitalizer:Init()\n    print(\"Init is called during Fibre.Start()!\")\n    Capitalizer.Client.MessageReceived = Fibre.RemoteSignal.new()\nend\n\nfunction Capitalizer:OnStart()\n    print(\"OnStart is called after Fibre.Start()!\")\nend\n\nfunction Capitalizer:AllCaps(s)\n    return string.upper(s)\nend\n\nfunction Capitalizer.Client:AllCaps(player, s)\n    self.Client.MessageReceived:FireClient(player, \"Got your message!\")\n    return self:AllCaps(s)\nend\n\nreturn Capitalizer\n```\n\nIn a client script:\n```lua\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\n\nlocal Fibre = require(ReplicatedStorage.Fibre)\nFibre.AddChildren(ReplicatedStorage.Services)\nFibre.Start(true)\n\nprint(Fibre.Client.Get(\"ClientCapitalizer\"):AllCaps(\"client\")) --> \"CLIENT\"\n```\n\nIn a module script named `ClientCapitalizer` in `ReplicatedStorage.Services`:\n```lua\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\n\nlocal Fibre = require(ReplicatedStorage.Fibre)\nlocal Capitalizer = Fibre.Server.Get(\"Capitalizer\")\n\nlocal ClientCapitalizer = {}\n\nfunction ClientCapitalizer:Init()\n    print(\"Init is called during Fibre.Start()!\")\n    Capitalizer.MessageReceived:Connect(function(msg)\n        print(msg) --> \"Got your message!\" anytime Capitalizer:AllCaps() is called\n    end)\nend\n\nfunction ClientCapitalizer:OnStart()\n    print(\"OnStart is called after Fibre.Start()!\")\nend\n\nfunction ClientCapitalizer:AllCaps(s)\n    return Capitalizer:AllCaps(s)\nend\n\nreturn ClientCapitalizer\n```\n\nFull Output:\n```\n[FIBRE] Initializing Capitalizer  -  Server\nInit is called during Fibre.Start()!  -  Server\n[FIBRE] Creating Remotes for Capitalizer  -  Server\n[FIBRE] Starting Capitalizer  -  Server\nStart is called after Fibre.Start()!  -  Server\n[FIBRE] Server Started!  -  Server\nSERVER  -  Server\n[FIBRE] Initializing ClientCapitalizer  -  Client\nInit is called during Fibre.Start()!  -  Client\n[FIBRE] Starting ClientCapitalizer  -  Client\nStart is called after Fibre.Start()!  -  Client\n[FIBRE] Client Started!  -  Client\nGot your message!  -  Client\nCLIENT  -  Client\n```\n\n# **Fibre API**\n\n## `Fibre.Add(Module: ModuleScript)`\nRequires a `ModuleScript` and adds it to Fibre. Must be called before `Fibre.Start()`.\n\n## `Fibre.AddChildren(Parent: Instance)`\nCalls `Fibre.Add()` on all children. Must be called before `Fibre.Start()`.\n\n## `Fibre.Server.Get(Service: string)`\nReturns a service from the server. Must be called after `Fibre.Start()` if being called from the server.\n\n## `Fibre.Client.Get(Service: string)`\nReturns a service from the client. Must be called after `Fibre.Start()`. Can only be called from the client.\n\n## `Fibre.Start(verbose: boolean)`\nStarts Fibre. If verbose is `true` a message will be printed for each service.\n\n## `Signal` & `RemoteSignal`\nThese are essentially just wrappers for `BindableEvent` and `RemoteEvent` respectively. Their API is super self explanatory, just take a quick look at their source code!\n","readmeBorrowedFrom":{"version":"0.2.1","source":"wally"},"readmeTruncated":false}